refactor: 重新调整数据库连接和环境变量配置
- 修改数据库连接配置,统一使用 Docker 内部网络地址 - 更新环境变量配置,简化 Redis 和 MinIO 的配置 - 删除 Helm 相关文件,清理 Kubernetes 部署配置 - 移除 ChatGPT-on-WeChat 插件相关代码和配置
This commit is contained in:
parent
ecaed85f84
commit
8f4c1187f0
|
@ -27,12 +27,12 @@ def is_running_in_docker():
|
|||
if is_running_in_docker():
|
||||
MYSQL_HOST = "mysql"
|
||||
MYSQL_PORT = 3306
|
||||
MINIO_HOST = os.getenv("MINIO_VISIT_HOST", "host.docker.internal")
|
||||
MINIO_HOST = "minio"
|
||||
MINIO_PORT = 9000
|
||||
ES_HOST = "es01"
|
||||
ES_PORT = 9200
|
||||
REDIS_HOST = os.getenv("REDIS_HOST", "redis")
|
||||
REDIS_PORT = int(os.getenv("REDIS_PORT", "6379"))
|
||||
REDIS_HOST = "redis"
|
||||
REDIS_PORT = 6379
|
||||
else:
|
||||
MYSQL_HOST = "localhost"
|
||||
MYSQL_PORT = int(os.getenv("MYSQL_PORT", "5455"))
|
||||
|
|
|
@ -50,8 +50,8 @@ MYSQL_PORT=5455
|
|||
|
||||
# The hostname where the MinIO service is exposed
|
||||
MINIO_HOST=minio
|
||||
# minio上传文件时的ip地址,如需公网访问,可修改为公网ip地址
|
||||
MINIO_VISIT_HOST=host.docker.internal
|
||||
# 访问minio文件时的ip地址,如需公网访问,可修改为公网ip地址
|
||||
MINIO_VISIT_HOST=localhost
|
||||
# The port used to expose the MinIO console interface to the host machine,
|
||||
# allowing EXTERNAL access to the web-based console running inside the Docker container.
|
||||
MINIO_CONSOLE_PORT=9001
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
|
@ -1,24 +0,0 @@
|
|||
apiVersion: v2
|
||||
name: ragflow
|
||||
description: A Helm chart for deploying RAGFlow on Kubernetes
|
||||
|
||||
# A chart can be either an 'application' or a 'library' chart.
|
||||
#
|
||||
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||
# to be deployed.
|
||||
#
|
||||
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||
type: application
|
||||
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 0.1.0
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
# It is recommended to use it with quotes.
|
||||
appVersion: "dev"
|
|
@ -1,62 +0,0 @@
|
|||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "ragflow.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "ragflow.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "ragflow.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "ragflow.labels" -}}
|
||||
helm.sh/chart: {{ include "ragflow.chart" . }}
|
||||
{{ include "ragflow.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "ragflow.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "ragflow.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "ragflow.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "ragflow.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -1,13 +0,0 @@
|
|||
{{- if eq .Values.env.DOC_ENGINE "elasticsearch" -}}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-es-config
|
||||
data:
|
||||
node.name: "es01"
|
||||
bootstrap.memory_lock: "false"
|
||||
discovery.type: "single-node"
|
||||
xpack.security.enabled: "true"
|
||||
xpack.security.http.ssl.enabled: "false"
|
||||
xpack.security.transport.ssl.enabled: "false"
|
||||
{{- end -}}
|
|
@ -1,111 +0,0 @@
|
|||
{{- if eq .Values.env.DOC_ENGINE "elasticsearch" -}}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-es-data
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: elasticsearch
|
||||
spec:
|
||||
{{- with .Values.elasticsearch.storage.className }}
|
||||
storageClassName: {{ . }}
|
||||
{{- end }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.elasticsearch.storage.capacity }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-es
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: elasticsearch
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "ragflow.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: elasticsearch
|
||||
{{- with .Values.elasticsearch.deployment.strategy }}
|
||||
strategy:
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: elasticsearch
|
||||
annotations:
|
||||
checksum/config-es: {{ include (print $.Template.BasePath "/elasticsearch-config.yaml") . | sha256sum }}
|
||||
checksum/config-env: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
|
||||
spec:
|
||||
initContainers:
|
||||
- name: fix-data-volume-permissions
|
||||
image: alpine
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- "chown -R 1000:0 /usr/share/elasticsearch/data"
|
||||
volumeMounts:
|
||||
- mountPath: /usr/share/elasticsearch/data
|
||||
name: es-data
|
||||
- name: sysctl
|
||||
image: busybox
|
||||
securityContext:
|
||||
privileged: true
|
||||
runAsUser: 0
|
||||
command: ["sysctl", "-w", "vm.max_map_count=262144"]
|
||||
containers:
|
||||
- name: elasticsearch
|
||||
image: elasticsearch:{{ .Values.env.STACK_VERSION }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ include "ragflow.fullname" . }}-env-config
|
||||
- configMapRef:
|
||||
name: {{ include "ragflow.fullname" . }}-es-config
|
||||
ports:
|
||||
- containerPort: 9200
|
||||
name: http
|
||||
- containerPort: 9300
|
||||
name: transport
|
||||
volumeMounts:
|
||||
- mountPath: /usr/share/elasticsearch/data
|
||||
name: es-data
|
||||
{{- with .Values.elasticsearch.deployment.resources }}
|
||||
resources:
|
||||
{{- . | toYaml | nindent 10 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
- "IPC_LOCK"
|
||||
runAsUser: 1000
|
||||
# NOTE: fsGroup doesn't seem to
|
||||
# work so use init container instead
|
||||
# fsGroup: 1000
|
||||
allowPrivilegeEscalation: false
|
||||
volumes:
|
||||
- name: es-data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "ragflow.fullname" . }}-es-data
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-es
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: elasticsearch
|
||||
spec:
|
||||
selector:
|
||||
{{- include "ragflow.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: elasticsearch
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 9200
|
||||
targetPort: http
|
||||
type: {{ .Values.elasticsearch.service.type }}
|
||||
{{- end -}}
|
|
@ -1,48 +0,0 @@
|
|||
{{- /*
|
||||
TODO: Split env vars into separate secrets so that each pod
|
||||
only gets passed the secrets it really needs.
|
||||
*/}}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-env-config
|
||||
type: Opaque
|
||||
stringData:
|
||||
{{- range $key, $val := .Values.env }}
|
||||
{{- if $val }}
|
||||
{{ $key }}: {{ quote $val }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- /*
|
||||
Use host names derived from internal cluster DNS
|
||||
*/}}
|
||||
REDIS_HOST: {{ printf "%s-redis.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
|
||||
MYSQL_HOST: {{ printf "%s-mysql.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
|
||||
MINIO_HOST: {{ printf "%s-minio.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
|
||||
{{- /*
|
||||
Fail if passwords are not provided in release values
|
||||
*/}}
|
||||
REDIS_PASSWORD: {{ .Values.env.REDIS_PASSWORD | required "REDIS_PASSWORD is required" }}
|
||||
{{- /*
|
||||
NOTE: MySQL uses MYSQL_ROOT_PASSWORD env var but Ragflow container expects
|
||||
MYSQL_PASSWORD so we need to define both as the same value here.
|
||||
*/}}
|
||||
{{- with .Values.env.MYSQL_PASSWORD | required "MYSQL_PASSWORD is required" }}
|
||||
MYSQL_PASSWORD: {{ . }}
|
||||
MYSQL_ROOT_PASSWORD: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.env.MINIO_PASSWORD | required "MINIO_PASSWORD is required" }}
|
||||
MINIO_PASSWORD: {{ . }}
|
||||
MINIO_ROOT_PASSWORD: {{ . }}
|
||||
{{- end }}
|
||||
{{- /*
|
||||
Only provide env vars for enabled doc engine
|
||||
*/}}
|
||||
{{- if eq .Values.env.DOC_ENGINE "elasticsearch" }}
|
||||
ES_HOST: {{ printf "%s-es.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
|
||||
ELASTIC_PASSWORD: {{ .Values.env.ELASTIC_PASSWORD | required "ELASTIC_PASSWORD is required" }}
|
||||
{{- else if eq .Values.env.DOC_ENGINE "infinity" }}
|
||||
INFINITY_HOST: {{ printf "%s-infinity.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
|
||||
{{- else }}
|
||||
{{ fail "env.DOC_ENGINE must be either 'elasticsearch' or 'infinity'" }}
|
||||
{{- end }}
|
|
@ -1,108 +0,0 @@
|
|||
{{- if eq .Values.env.DOC_ENGINE "infinity" -}}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-infinity
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: infinity
|
||||
spec:
|
||||
{{- with .Values.infinity.storage.className }}
|
||||
storageClassName: {{ . }}
|
||||
{{- end }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.infinity.storage.capacity }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-infinity
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: infinity
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "ragflow.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: infinity
|
||||
{{- with .Values.infinity.deployment.strategy }}
|
||||
strategy:
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: infinity
|
||||
annotations:
|
||||
checksum/config: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
|
||||
spec:
|
||||
containers:
|
||||
- name: infinity
|
||||
image: {{ .Values.infinity.image.repository }}:{{ .Values.infinity.image.tag }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ include "ragflow.fullname" . }}-env-config
|
||||
ports:
|
||||
- containerPort: 23817
|
||||
name: thrift
|
||||
- containerPort: 23820
|
||||
name: http
|
||||
- containerPort: 5432
|
||||
name: psql
|
||||
volumeMounts:
|
||||
- mountPath: /var/infinity
|
||||
name: infinity-data
|
||||
{{- with .Values.infinity.deployment.resources }}
|
||||
resources:
|
||||
{{- . | toYaml | nindent 10 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
- "NET_BIND_SERVICE"
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /admin/node/current
|
||||
port: 23820
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 10
|
||||
failureThreshold: 120
|
||||
volumes:
|
||||
- name: infinity-data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "ragflow.fullname" . }}-infinity
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-infinity
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: infinity
|
||||
spec:
|
||||
selector:
|
||||
{{- include "ragflow.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: infinity
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 23817
|
||||
targetPort: thrift
|
||||
name: thrift
|
||||
- protocol: TCP
|
||||
port: 23820
|
||||
targetPort: http
|
||||
name: http
|
||||
- protocol: TCP
|
||||
port: 5432
|
||||
targetPort: psql
|
||||
name: psql
|
||||
type: {{ .Values.infinity.service.type }}
|
||||
{{- end -}}
|
|
@ -1,43 +0,0 @@
|
|||
{{- if .Values.ingress.enabled -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.ingress.className }}
|
||||
ingressClassName: {{ . }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
{{- with .pathType }}
|
||||
pathType: {{ . }}
|
||||
{{- end }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ .Release.Name }}
|
||||
port:
|
||||
name: http
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -1,91 +0,0 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-minio
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: minio
|
||||
spec:
|
||||
{{- with .Values.minio.storage.className }}
|
||||
storageClassName: {{ . }}
|
||||
{{- end }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.minio.storage.capacity }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: ragflow-minio-deployment
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: minio
|
||||
annotations:
|
||||
checksum/config: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "ragflow.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: minio
|
||||
{{- with .Values.minio.deployment.strategy }}
|
||||
strategy:
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: minio
|
||||
spec:
|
||||
containers:
|
||||
- name: minio
|
||||
image: {{ .Values.minio.image.repository }}:{{ .Values.minio.image.tag }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ include "ragflow.fullname" . }}-env-config
|
||||
args:
|
||||
- server
|
||||
- "--console-address=:9001"
|
||||
- "/data"
|
||||
ports:
|
||||
- containerPort: 9000
|
||||
name: s3
|
||||
- containerPort: 9001
|
||||
name: console
|
||||
{{- with .Values.minio.deployment.resources }}
|
||||
resources:
|
||||
{{- . | toYaml | nindent 10 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- mountPath: /data
|
||||
name: minio-data
|
||||
volumes:
|
||||
- name: minio-data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "ragflow.fullname" . }}-minio
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-minio
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: minio
|
||||
spec:
|
||||
selector:
|
||||
{{- include "ragflow.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: minio
|
||||
ports:
|
||||
- name: s3
|
||||
protocol: TCP
|
||||
port: 9000
|
||||
targetPort: s3
|
||||
- name: console
|
||||
protocol: TCP
|
||||
port: 9001
|
||||
targetPort: console
|
||||
type: {{ .Values.minio.service.type }}
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: mysql-init-script
|
||||
data:
|
||||
init.sql: |-
|
||||
CREATE DATABASE IF NOT EXISTS rag_flow;
|
||||
USE rag_flow;
|
|
@ -1,96 +0,0 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-mysql
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: mysql
|
||||
spec:
|
||||
{{- with .Values.mysql.storage.className }}
|
||||
storageClassName: {{ . }}
|
||||
{{- end }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.mysql.storage.capacity }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-mysql
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: mysql
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "ragflow.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: mysql
|
||||
{{- with .Values.mysql.deployment.strategy }}
|
||||
strategy:
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: mysql
|
||||
annotations:
|
||||
checksum/config-mysql: {{ include (print $.Template.BasePath "/mysql-config.yaml") . | sha256sum }}
|
||||
checksum/config-env: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
|
||||
spec:
|
||||
containers:
|
||||
- name: mysql
|
||||
image: {{ .Values.mysql.image.repository }}:{{ .Values.mysql.image.tag }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ include "ragflow.fullname" . }}-env-config
|
||||
args:
|
||||
- --max_connections=1000
|
||||
- --character-set-server=utf8mb4
|
||||
- --collation-server=utf8mb4_general_ci
|
||||
- --default-authentication-plugin=mysql_native_password
|
||||
- --tls_version=TLSv1.2,TLSv1.3
|
||||
- --init-file=/data/application/init.sql
|
||||
- --disable-log-bin
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
name: mysql
|
||||
{{- with .Values.mysql.deployment.resources }}
|
||||
resources:
|
||||
{{- . | toYaml | nindent 10 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- mountPath: /var/lib/mysql
|
||||
name: mysql-data
|
||||
- mountPath: /data/application/init.sql
|
||||
subPath: init.sql
|
||||
readOnly: true
|
||||
name: init-script-volume
|
||||
volumes:
|
||||
- name: mysql-data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "ragflow.fullname" . }}-mysql
|
||||
- name: init-script-volume
|
||||
configMap:
|
||||
name: mysql-init-script
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-mysql
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: mysql
|
||||
spec:
|
||||
selector:
|
||||
{{- include "ragflow.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: mysql
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 3306
|
||||
targetPort: mysql
|
||||
type: {{ .Values.mysql.service.type }}
|
|
@ -1,94 +0,0 @@
|
|||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: ragflow
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "ragflow.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: ragflow
|
||||
{{- with .Values.ragflow.deployment.strategy }}
|
||||
strategy:
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: ragflow
|
||||
annotations:
|
||||
checksum/config-env: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
|
||||
checksum/config-ragflow: {{ include (print $.Template.BasePath "/ragflow_config.yaml") . | sha256sum }}
|
||||
spec:
|
||||
containers:
|
||||
- name: ragflow
|
||||
image: {{ .Values.env.RAGFLOW_IMAGE }}
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: http
|
||||
- containerPort: 9380
|
||||
name: http-api
|
||||
volumeMounts:
|
||||
- mountPath: /etc/nginx/conf.d/ragflow.conf
|
||||
subPath: ragflow.conf
|
||||
name: nginx-config-volume
|
||||
- mountPath: /etc/nginx/proxy.conf
|
||||
subPath: proxy.conf
|
||||
name: nginx-config-volume
|
||||
- mountPath: /etc/nginx/nginx.conf
|
||||
subPath: nginx.conf
|
||||
name: nginx-config-volume
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ include "ragflow.fullname" . }}-env-config
|
||||
{{- with .Values.ragflow.deployment.resources }}
|
||||
resources:
|
||||
{{- . | toYaml | nindent 10 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: nginx-config-volume
|
||||
configMap:
|
||||
name: nginx-config
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: ragflow
|
||||
spec:
|
||||
selector:
|
||||
{{- include "ragflow.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: ragflow
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: http
|
||||
name: http
|
||||
type: {{ .Values.ragflow.service.type }}
|
||||
---
|
||||
{{- if .Values.ragflow.api.service.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-api
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: ragflow
|
||||
spec:
|
||||
selector:
|
||||
{{- include "ragflow.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: ragflow
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: http-api
|
||||
name: http-api
|
||||
type: {{ .Values.ragflow.api.service.type }}
|
||||
{{- end }}
|
|
@ -1,75 +0,0 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: nginx-config
|
||||
data:
|
||||
ragflow.conf: |
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /ragflow/web/dist;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_comp_level 9;
|
||||
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
|
||||
gzip_vary on;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
location ~ ^/(v1|api) {
|
||||
proxy_pass http://localhost:9380;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
location / {
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Cache-Control: max-age~@~AExpires
|
||||
location ~ ^/static/(css|js|media)/ {
|
||||
expires 10y;
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
proxy.conf: |
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
proxy_buffering off;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
nginx.conf: |
|
||||
user root;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
client_max_body_size 128M;
|
||||
|
||||
include /etc/nginx/conf.d/ragflow.conf;
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-redis
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: redis
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 8Gi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-redis
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: redis
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "ragflow.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: redis
|
||||
{{- with .Values.redis.deployment.strategy }}
|
||||
strategy:
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: redis
|
||||
annotations:
|
||||
checksum/config-env: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
|
||||
spec:
|
||||
containers:
|
||||
- name: redis
|
||||
image: {{ .Values.redis.image.repository }}:{{ .Values.redis.image.tag }}
|
||||
command:
|
||||
- "sh"
|
||||
- "-c"
|
||||
- "exec redis-server --requirepass ${REDIS_PASSWORD} --maxmemory 128mb --maxmemory-policy allkeys-lru"
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ include "ragflow.fullname" . }}-env-config
|
||||
ports:
|
||||
- containerPort: 6379
|
||||
name: redis
|
||||
{{- with .Values.redis.deployment.resources }}
|
||||
resources:
|
||||
{{- . | toYaml | nindent 10 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- mountPath: /data
|
||||
name: redis-data
|
||||
volumes:
|
||||
- name: redis-data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "ragflow.fullname" . }}-redis
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "ragflow.fullname" . }}-redis
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: redis
|
||||
spec:
|
||||
selector:
|
||||
{{- include "ragflow.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: redis
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 6379
|
||||
targetPort: redis
|
||||
type: {{ .Values.redis.service.type }}
|
|
@ -1,17 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: "{{ include "ragflow.fullname" . }}-test-connection"
|
||||
labels:
|
||||
{{- include "ragflow.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
spec:
|
||||
containers:
|
||||
- name: wget
|
||||
image: busybox
|
||||
command:
|
||||
- 'wget'
|
||||
args:
|
||||
- {{ printf "%s.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
|
||||
restartPolicy: Never
|
159
helm/values.yaml
159
helm/values.yaml
|
@ -1,159 +0,0 @@
|
|||
# Based on docker compose .env file
|
||||
env:
|
||||
# The type of doc engine to use.
|
||||
# Available options:
|
||||
# - `elasticsearch` (default)
|
||||
# - `infinity` (https://github.com/infiniflow/infinity)
|
||||
# DOC_ENGINE: elasticsearch
|
||||
DOC_ENGINE: infinity
|
||||
|
||||
# The version of Elasticsearch.
|
||||
STACK_VERSION: "8.11.3"
|
||||
|
||||
# The password for Elasticsearch
|
||||
ELASTIC_PASSWORD: infini_rag_flow_helm
|
||||
|
||||
# The password for MySQL
|
||||
MYSQL_PASSWORD: infini_rag_flow_helm
|
||||
# The database of the MySQL service to use
|
||||
MYSQL_DBNAME: rag_flow
|
||||
|
||||
# The username for MinIO.
|
||||
MINIO_ROOT_USER: rag_flow
|
||||
# The password for MinIO
|
||||
MINIO_PASSWORD: infini_rag_flow_helm
|
||||
|
||||
# The password for Redis
|
||||
REDIS_PASSWORD: infini_rag_flow_helm
|
||||
|
||||
# The RAGFlow Docker image to download.
|
||||
# Defaults to the v0.17.2-slim edition, which is the RAGFlow Docker image without embedding models.
|
||||
RAGFLOW_IMAGE: infiniflow/ragflow:v0.17.2-slim
|
||||
#
|
||||
# To download the RAGFlow Docker image with embedding models, uncomment the following line instead:
|
||||
# RAGFLOW_IMAGE: infiniflow/ragflow:v0.17.2
|
||||
#
|
||||
# The Docker image of the v0.17.2 edition includes:
|
||||
# - Built-in embedding models:
|
||||
# - BAAI/bge-large-zh-v1.5
|
||||
# - BAAI/bge-reranker-v2-m3
|
||||
# - maidalun1020/bce-embedding-base_v1
|
||||
# - maidalun1020/bce-reranker-base_v1
|
||||
# - Embedding models that will be downloaded once you select them in the RAGFlow UI:
|
||||
# - BAAI/bge-base-en-v1.5
|
||||
# - BAAI/bge-large-en-v1.5
|
||||
# - BAAI/bge-small-en-v1.5
|
||||
# - BAAI/bge-small-zh-v1.5
|
||||
# - jinaai/jina-embeddings-v2-base-en
|
||||
# - jinaai/jina-embeddings-v2-small-en
|
||||
# - nomic-ai/nomic-embed-text-v1.5
|
||||
# - sentence-transformers/all-MiniLM-L6-v2
|
||||
#
|
||||
#
|
||||
|
||||
# The local time zone.
|
||||
TIMEZONE: "Asia/Shanghai"
|
||||
|
||||
# Uncomment the following line if you have limited access to huggingface.co:
|
||||
# HF_ENDPOINT: https://hf-mirror.com
|
||||
|
||||
# The maximum file size for each uploaded file, in bytes.
|
||||
# You can uncomment this line and update the value if you wish to change 128M file size limit
|
||||
# MAX_CONTENT_LENGTH: "134217728"
|
||||
# After making the change, ensure you update `client_max_body_size` in nginx/nginx.conf correspondingly.
|
||||
|
||||
ragflow:
|
||||
deployment:
|
||||
strategy:
|
||||
resources:
|
||||
service:
|
||||
# Use LoadBalancer to expose the web interface externally
|
||||
type: ClusterIP
|
||||
api:
|
||||
service:
|
||||
enabled: true
|
||||
type: ClusterIP
|
||||
|
||||
infinity:
|
||||
image:
|
||||
repository: infiniflow/infinity
|
||||
tag: v0.5.0
|
||||
storage:
|
||||
className:
|
||||
capacity: 5Gi
|
||||
deployment:
|
||||
strategy:
|
||||
resources:
|
||||
service:
|
||||
type: ClusterIP
|
||||
|
||||
elasticsearch:
|
||||
storage:
|
||||
className:
|
||||
capacity: 20Gi
|
||||
deployment:
|
||||
strategy:
|
||||
resources:
|
||||
requests:
|
||||
cpu: "4"
|
||||
memory: "16Gi"
|
||||
service:
|
||||
type: ClusterIP
|
||||
|
||||
minio:
|
||||
image:
|
||||
repository: quay.io/minio/minio
|
||||
tag: RELEASE.2023-12-20T01-00-02Z
|
||||
storage:
|
||||
className:
|
||||
capacity: 5Gi
|
||||
deployment:
|
||||
strategy:
|
||||
resources:
|
||||
service:
|
||||
type: ClusterIP
|
||||
|
||||
mysql:
|
||||
image:
|
||||
repository: mysql
|
||||
tag: 8.0.39
|
||||
storage:
|
||||
className:
|
||||
capacity: 5Gi
|
||||
deployment:
|
||||
strategy:
|
||||
resources:
|
||||
service:
|
||||
type: ClusterIP
|
||||
|
||||
redis:
|
||||
image:
|
||||
repository: valkey/valkey
|
||||
tag: 8
|
||||
storage:
|
||||
className:
|
||||
capacity: 5Gi
|
||||
deployment:
|
||||
strategy:
|
||||
resources:
|
||||
service:
|
||||
type: ClusterIP
|
||||
|
||||
|
||||
# This block is for setting up web service ingress. For more information, see:
|
||||
# https://kubernetes.io/docs/concepts/services-networking/ingress/
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
hosts:
|
||||
- host: chart-example.local
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
tls: []
|
||||
# - secretName: chart-example-tls
|
||||
# hosts:
|
||||
# - chart-example.local
|
|
@ -1,57 +0,0 @@
|
|||
RAGFlow Chat Plugin for ChatGPT-on-WeChat
|
||||
=========================================
|
||||
|
||||
This folder contains the source code for the `ragflow_chat` plugin, which extends the core functionality of the RAGFlow API to support conversational interactions using Retrieval-Augmented Generation (RAG). This plugin integrates seamlessly with the [ChatGPT-on-WeChat](https://github.com/zhayujie/chatgpt-on-wechat) project, enabling WeChat and other platforms to leverage the knowledge retrieval capabilities provided by RAGFlow in chat interactions.
|
||||
|
||||
### Features
|
||||
* **Conversational Interactions**: Combine WeChat's conversational interface with powerful RAG (Retrieval-Augmented Generation) capabilities.
|
||||
* **Knowledge-Based Responses**: Enrich conversations by retrieving relevant data from external knowledge sources and incorporating them into chat responses.
|
||||
* **Multi-Platform Support**: Works across WeChat, WeCom, and various other platforms supported by the ChatGPT-on-WeChat framework.
|
||||
|
||||
### Plugin vs. ChatGPT-on-WeChat Configurations
|
||||
**Note**: There are two distinct configuration files used in this setup—one for the ChatGPT-on-WeChat core project and another specific to the `ragflow_chat` plugin. It is important to configure both correctly to ensure smooth integration.
|
||||
|
||||
#### ChatGPT-on-WeChat Root Configuration (`config.json`)
|
||||
This file is located in the root directory of the [ChatGPT-on-WeChat](https://github.com/zhayujie/chatgpt-on-wechat) project and is responsible for defining the communication channels and overall behavior. For example, it handles the configuration for WeChat, WeCom, and other services like Feishu and DingTalk.
|
||||
|
||||
Example `config.json` (for WeChat channel):
|
||||
```json
|
||||
{
|
||||
"channel_type": "wechatmp",
|
||||
"wechatmp_app_id": "YOUR_APP_ID",
|
||||
"wechatmp_app_secret": "YOUR_APP_SECRET",
|
||||
"wechatmp_token": "YOUR_TOKEN",
|
||||
"wechatmp_port": 80,
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
This file can also be modified to support other communication platforms, such as:
|
||||
- **Personal WeChat** (`channel_type: wx`)
|
||||
- **WeChat Public Account** (`wechatmp` or `wechatmp_service`)
|
||||
- **WeChat Work (WeCom)** (`wechatcom_app`)
|
||||
- **Feishu** (`feishu`)
|
||||
- **DingTalk** (`dingtalk`)
|
||||
|
||||
For detailed configuration options, see the official [LinkAI documentation](https://docs.link-ai.tech/cow/multi-platform/wechat-mp).
|
||||
|
||||
#### RAGFlow Chat Plugin Configuration (`plugins/ragflow_chat/config.json`)
|
||||
This configuration is specific to the `ragflow_chat` plugin and is used to set up communication with the RAGFlow server. Ensure that your RAGFlow server is running, and update the plugin's `config.json` file with your server details:
|
||||
|
||||
Example `config.json` (for `ragflow_chat`):
|
||||
```json
|
||||
{
|
||||
"ragflow_api_key": "YOUR_API_KEY",
|
||||
"ragflow_host": "127.0.0.1:80"
|
||||
}
|
||||
```
|
||||
|
||||
This file must be configured to point to your RAGFlow instance, with the `ragflow_api_key` and `ragflow_host` fields set appropriately. The `ragflow_host` is typically your server's address and port number, and the `ragflow_api_key` is obtained from your RAGFlow API setup.
|
||||
|
||||
### Requirements
|
||||
Before you can use this plugin, ensure the following are in place:
|
||||
|
||||
1. You have installed and configured [ChatGPT-on-WeChat](https://github.com/zhayujie/chatgpt-on-wechat).
|
||||
2. You have deployed and are running the [RAGFlow](https://github.com/infiniflow/ragflow) server.
|
||||
|
||||
Make sure both `config.json` files (ChatGPT-on-WeChat and RAGFlow Chat Plugin) are correctly set up as per the examples above.
|
|
@ -1,8 +0,0 @@
|
|||
from beartype.claw import beartype_this_package
|
||||
from .ragflow_chat import RAGFlowChat
|
||||
|
||||
beartype_this_package()
|
||||
|
||||
__all__ = [
|
||||
"RAGFlowChat"
|
||||
]
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"api_key": "ragflow-***",
|
||||
"host_address": "127.0.0.1:80"
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
#
|
||||
# Copyright 2025 The InfiniFlow Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
import logging
|
||||
import requests
|
||||
from bridge.context import ContextType # Import Context, ContextType
|
||||
from bridge.reply import Reply, ReplyType # Import Reply, ReplyType
|
||||
from plugins import Plugin, register # Import Plugin and register
|
||||
from plugins.event import Event, EventContext, EventAction # Import event-related classes
|
||||
|
||||
@register(name="RAGFlowChat", desc="Use RAGFlow API to chat", version="1.0", author="Your Name")
|
||||
class RAGFlowChat(Plugin):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
# Load plugin configuration
|
||||
self.cfg = self.load_config()
|
||||
# Bind event handling function
|
||||
self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context
|
||||
# Store conversation_id for each user
|
||||
self.conversations = {}
|
||||
logging.info("[RAGFlowChat] Plugin initialized")
|
||||
|
||||
def on_handle_context(self, e_context: EventContext):
|
||||
context = e_context['context']
|
||||
if context.type != ContextType.TEXT:
|
||||
return # Only process text messages
|
||||
|
||||
user_input = context.content.strip()
|
||||
session_id = context['session_id']
|
||||
|
||||
# Call RAGFlow API to get a reply
|
||||
reply_text = self.get_ragflow_reply(user_input, session_id)
|
||||
if reply_text:
|
||||
reply = Reply()
|
||||
reply.type = ReplyType.TEXT
|
||||
reply.content = reply_text
|
||||
e_context['reply'] = reply
|
||||
e_context.action = EventAction.BREAK_PASS # Skip the default processing logic
|
||||
else:
|
||||
# If no reply is received, pass to the next plugin or default logic
|
||||
e_context.action = EventAction.CONTINUE
|
||||
|
||||
def get_ragflow_reply(self, user_input, session_id):
|
||||
# Get API_KEY and host address from the configuration
|
||||
api_key = self.cfg.get("api_key")
|
||||
host_address = self.cfg.get("host_address")
|
||||
user_id = session_id # Use session_id as user_id
|
||||
|
||||
if not api_key or not host_address:
|
||||
logging.error("[RAGFlowChat] Missing configuration")
|
||||
return "The plugin configuration is incomplete. Please check the configuration."
|
||||
|
||||
headers = {
|
||||
"Authorization": f"Bearer {api_key}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
# Step 1: Get or create conversation_id
|
||||
conversation_id = self.conversations.get(user_id)
|
||||
if not conversation_id:
|
||||
# Create a new conversation
|
||||
url_new_conversation = f"http://{host_address}/v1/api/new_conversation"
|
||||
params_new_conversation = {
|
||||
"user_id": user_id
|
||||
}
|
||||
try:
|
||||
response = requests.get(url_new_conversation, headers=headers, params=params_new_conversation)
|
||||
logging.debug(f"[RAGFlowChat] New conversation response: {response.text}")
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
if data.get("code") == 0:
|
||||
conversation_id = data["data"]["id"]
|
||||
self.conversations[user_id] = conversation_id
|
||||
else:
|
||||
logging.error(f"[RAGFlowChat] Failed to create conversation: {data.get('message')}")
|
||||
return f"Sorry, unable to create a conversation: {data.get('message')}"
|
||||
else:
|
||||
logging.error(f"[RAGFlowChat] HTTP error when creating conversation: {response.status_code}")
|
||||
return f"Sorry, unable to connect to RAGFlow API (create conversation). HTTP status code: {response.status_code}"
|
||||
except Exception as e:
|
||||
logging.exception("[RAGFlowChat] Exception when creating conversation")
|
||||
return f"Sorry, an internal error occurred: {str(e)}"
|
||||
|
||||
# Step 2: Send the message and get a reply
|
||||
url_completion = f"http://{host_address}/v1/api/completion"
|
||||
payload_completion = {
|
||||
"conversation_id": conversation_id,
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": user_input
|
||||
}
|
||||
],
|
||||
"quote": False,
|
||||
"stream": False
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.post(url_completion, headers=headers, json=payload_completion)
|
||||
logging.debug(f"[RAGFlowChat] Completion response: {response.text}")
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
if data.get("code") == 0:
|
||||
answer = data["data"]["answer"]
|
||||
return answer
|
||||
else:
|
||||
logging.error(f"[RAGFlowChat] Failed to get answer: {data.get('message')}")
|
||||
return f"Sorry, unable to get a reply: {data.get('message')}"
|
||||
else:
|
||||
logging.error(f"[RAGFlowChat] HTTP error when getting answer: {response.status_code}")
|
||||
return f"Sorry, unable to connect to RAGFlow API (get reply). HTTP status code: {response.status_code}"
|
||||
except Exception as e:
|
||||
logging.exception("[RAGFlowChat] Exception when getting answer")
|
||||
return f"Sorry, an internal error occurred: {str(e)}"
|
|
@ -1 +0,0 @@
|
|||
requests
|
|
@ -1,45 +0,0 @@
|
|||
# Chrome Extension
|
||||
```
|
||||
chrome-extension/
|
||||
│
|
||||
├── manifest.json # Main configuration file for the extension
|
||||
├── popup.html # Main user interface of the extension
|
||||
├── popup.js # Script for the main interface
|
||||
├── background.js # Background script for the extension
|
||||
├── content.js # Script to interact with web pages
|
||||
├── styles/
|
||||
│ └── popup.css # CSS file for the popup
|
||||
├── icons/
|
||||
│ ├── icon16.png # 16x16 pixel icon
|
||||
│ ├── icon48.png # 48x48 pixel icon
|
||||
│ └── icon128.png # 128x128 pixel icon
|
||||
├── assets/
|
||||
│ └── ... # Directory for other assets (images, fonts, etc.)
|
||||
├── scripts/
|
||||
│ ├── utils.js # File containing utility functions
|
||||
│ └── api.js # File containing API call logic
|
||||
└── README.md # Instructions for using and installing the extension
|
||||
```
|
||||
|
||||
# Installation
|
||||
1. Open chrome://extensions/.
|
||||
2. Enable Developer mode.
|
||||
3. Click Load unpacked and select the project directory.
|
||||
# Features
|
||||
1. Interact with web pages.
|
||||
2. Run in the background to handle logic.
|
||||
# Usage
|
||||
- Click the extension icon in the toolbar.
|
||||
- Follow the instructions in the interface.
|
||||
# Additional Notes
|
||||
- **manifest.json**: This file is crucial as it defines the extension's metadata, permissions, and entry points.
|
||||
- **background.js**: This script runs independently of any web page and can perform tasks such as listening for browser events, making network requests, and storing data.
|
||||
- **content.js**: This script injects code into web pages to manipulate the DOM, modify styles, or communicate with the background script.
|
||||
- **popup.html/popup.js**: These files create the popup that appears when the user clicks the extension icon.
|
||||
icons: These icons are used to represent the extension in the browser's UI.
|
||||
More Detailed Explanation
|
||||
- **manifest.json**: Specifies the extension's name, version, permissions, and other details. It also defines the entry points for the background script, content scripts, and the popup.
|
||||
- **background.js**: Handles tasks that need to run continuously, such as syncing data, listening for browser events, or controlling the extension's behavior.
|
||||
- **content.js**: Interacts directly with the web page's DOM, allowing you to modify the content, style, or behavior of the page.
|
||||
- **popup.html/popup.js**: Creates a user interface that allows users to interact with the extension.
|
||||
Other files: These files can contain additional scripts, styles, or assets that are used by the extension.
|
Binary file not shown.
Before Width: | Height: | Size: 8.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 93 KiB |
|
@ -1,29 +0,0 @@
|
|||
<svg width="32" height="34" viewBox="0 0 32 34" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M3.43265 20.7677C4.15835 21.5062 4.15834 22.7035 3.43262 23.4419L3.39546 23.4797C2.66974 24.2182 1.49312 24.2182 0.767417 23.4797C0.0417107 22.7412 0.0417219 21.544 0.767442 20.8055L0.804608 20.7677C1.53033 20.0292 2.70694 20.0293 3.43265 20.7677Z"
|
||||
fill="#B2DDFF" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M12.1689 21.3375C12.8933 22.0773 12.8912 23.2746 12.1641 24.0117L7.01662 29.2307C6.2896 29.9678 5.11299 29.9657 4.38859 29.2259C3.66419 28.4861 3.66632 27.2888 4.39334 26.5517L9.54085 21.3327C10.2679 20.5956 11.4445 20.5977 12.1689 21.3375Z"
|
||||
fill="#53B1FD" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M19.1551 30.3217C19.7244 29.4528 20.8781 29.218 21.7321 29.7973L21.8436 29.8729C22.6975 30.4522 22.9283 31.6262 22.359 32.4952C21.7897 33.3641 20.6359 33.5989 19.782 33.0196L19.6705 32.944C18.8165 32.3647 18.5858 31.1907 19.1551 30.3217Z"
|
||||
fill="#B2DDFF" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M31.4184 20.6544C32.1441 21.3929 32.1441 22.5902 31.4184 23.3286L28.8911 25.9003C28.1654 26.6388 26.9887 26.6388 26.263 25.9003C25.5373 25.1619 25.5373 23.9646 26.263 23.2261L28.7903 20.6544C29.516 19.916 30.6927 19.916 31.4184 20.6544Z"
|
||||
fill="#53B1FD" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M31.4557 11.1427C32.1814 11.8812 32.1814 13.0785 31.4557 13.8169L12.7797 32.8209C12.054 33.5594 10.8774 33.5594 10.1517 32.8209C9.42599 32.0825 9.42599 30.8852 10.1517 30.1467L28.8277 11.1427C29.5534 10.4043 30.73 10.4043 31.4557 11.1427Z"
|
||||
fill="#1570EF" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M27.925 5.29994C28.6508 6.0384 28.6508 7.23568 27.925 7.97414L17.184 18.9038C16.4583 19.6423 15.2817 19.6423 14.556 18.9038C13.8303 18.1653 13.8303 16.9681 14.556 16.2296L25.297 5.29994C26.0227 4.56148 27.1993 4.56148 27.925 5.29994Z"
|
||||
fill="#1570EF" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M22.256 1.59299C22.9822 2.33095 22.983 3.52823 22.2578 4.26718L8.45055 18.3358C7.72533 19.0748 6.54871 19.0756 5.82251 18.3376C5.09631 17.5996 5.09552 16.4024 5.82075 15.6634L19.6279 1.59478C20.3532 0.855827 21.5298 0.855022 22.256 1.59299Z"
|
||||
fill="#1570EF" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M8.58225 6.09619C9.30671 6.83592 9.30469 8.0332 8.57772 8.77038L3.17006 14.2541C2.4431 14.9913 1.26649 14.9893 0.542025 14.2495C-0.182438 13.5098 -0.180413 12.3125 0.546548 11.5753L5.95421 6.09159C6.68117 5.3544 7.85778 5.35646 8.58225 6.09619Z"
|
||||
fill="#53B1FD" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd"
|
||||
d="M11.893 0.624023C12.9193 0.624023 13.7513 1.47063 13.7513 2.51497V2.70406C13.7513 3.7484 12.9193 4.59501 11.893 4.59501C10.8667 4.59501 10.0347 3.7484 10.0347 2.70406V2.51497C10.0347 1.47063 10.8667 0.624023 11.893 0.624023Z"
|
||||
fill="#B2DDFF" />
|
||||
</svg>
|
Before Width: | Height: | Size: 3.0 KiB |
|
@ -1,17 +0,0 @@
|
|||
chrome.runtime.onInstalled.addListener(() => {
|
||||
console.log("Tiện ích đã được cài đặt!");
|
||||
});
|
||||
|
||||
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
if (message.action === "PAGE_INFO") {
|
||||
console.log( message);
|
||||
|
||||
|
||||
chrome.storage.local.set({ pageInfo: message }, () => {
|
||||
console.log("Page info saved to local storage.");
|
||||
});
|
||||
|
||||
// Send a response to the content script
|
||||
sendResponse({ status: "success", message: "Page info received and processed." });
|
||||
}
|
||||
});
|
|
@ -1,68 +0,0 @@
|
|||
(function () {
|
||||
const extractElementData = (el) => {
|
||||
const tag = el.tagName.toLowerCase();
|
||||
if (
|
||||
tag === "input" &&
|
||||
el.name !== "DXScript" &&
|
||||
el.name !== "DXMVCEditorsValues" &&
|
||||
el.name !== "DXCss"
|
||||
) {
|
||||
return {
|
||||
type: "input",
|
||||
name: el.name,
|
||||
value:
|
||||
el.type === "checkbox" || el.type === "radio"
|
||||
? el.checked
|
||||
? el.value
|
||||
: null
|
||||
: el.value,
|
||||
};
|
||||
} else if (tag === "select") {
|
||||
const selectedOption = el.querySelector("option:checked");
|
||||
return {
|
||||
type: "select",
|
||||
name: el.name,
|
||||
value: selectedOption ? selectedOption.value : null,
|
||||
};
|
||||
} else if (tag.startsWith("h") && el.textContent.trim()) {
|
||||
return { type: "header", tag, content: el.textContent.trim() };
|
||||
} else if (
|
||||
["label", "span", "p", "b", "strong"].includes(tag) &&
|
||||
el.textContent.trim()
|
||||
) {
|
||||
return { type: tag, content: el.textContent.trim() };
|
||||
}
|
||||
};
|
||||
|
||||
const getElementValues = (els) =>
|
||||
Array.from(els).map(extractElementData).filter(Boolean);
|
||||
|
||||
const getIframeInputValues = (iframe) => {
|
||||
try {
|
||||
const iframeDoc = iframe.contentWindow.document;
|
||||
return getElementValues(
|
||||
iframeDoc.querySelectorAll("input, select, header, label, span, p")
|
||||
);
|
||||
} catch (e) {
|
||||
console.error("Can't access iframe:", e);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
const inputValues = getElementValues(
|
||||
document.querySelectorAll("input, select, header, label, span, p")
|
||||
);
|
||||
const iframeInputValues = Array.from(document.querySelectorAll("iframe")).map(
|
||||
getIframeInputValues
|
||||
);
|
||||
|
||||
return `
|
||||
## input values\n
|
||||
\`\`\`json\n
|
||||
${JSON.stringify(inputValues)}\n
|
||||
\`\`\`\n
|
||||
## iframe input values\n
|
||||
\`\`\`json\n
|
||||
${JSON.stringify(iframeInputValues)}\n
|
||||
\`\`\``;
|
||||
})();
|
Binary file not shown.
Before Width: | Height: | Size: 8.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 716 B |
Binary file not shown.
Before Width: | Height: | Size: 3.2 KiB |
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Ragflow Extension",
|
||||
"description": "Ragflow for Chrome",
|
||||
"version": "1.0",
|
||||
"options_page": "options.html",
|
||||
|
||||
"permissions": ["activeTab", "scripting", "storage"],
|
||||
"background": {
|
||||
"service_worker": "background.js"
|
||||
},
|
||||
|
||||
"action": {
|
||||
"default_popup": "popup.html",
|
||||
"default_icon": {
|
||||
"16": "icons/icon-16x16.png",
|
||||
"48": "icons/icon-48x48.png",
|
||||
"128": "icons/icon-128x128.png"
|
||||
}
|
||||
},
|
||||
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["<all_urls>"],
|
||||
"js": ["content.js"],
|
||||
"css": ["styles/popup.css"]
|
||||
}
|
||||
],
|
||||
"icons": {
|
||||
"16": "icons/icon-16x16.png",
|
||||
"48": "icons/icon-48x48.png",
|
||||
"128": "icons/icon-128x128.png"
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>RagFlow option</title>
|
||||
<link rel="stylesheet" href="styles/options.css" />
|
||||
</head>
|
||||
|
||||
<body id="ragflow">
|
||||
<div id="form-config">
|
||||
<div class="header">
|
||||
<img src="assets/logo-with-text.png" alt="Logo" class="logo" />
|
||||
</div>
|
||||
<div class="content">
|
||||
<label for="base-url">Base URL:</label>
|
||||
<input type="text" id="base-url" placeholder="Enter base URL" />
|
||||
|
||||
<label for="from">From:</label>
|
||||
<select id="from">
|
||||
<option selected value="agent">agent</option>
|
||||
<option value="chat">chat</option>
|
||||
</select>
|
||||
|
||||
<label for="auth">Auth:</label>
|
||||
<input type="text" id="auth" placeholder="Enter auth" />
|
||||
|
||||
<label for="shared-id">Shared ID:</label>
|
||||
<input type="text" id="shared-id" placeholder="Enter shared ID" />
|
||||
|
||||
<button id="save-config">🛖</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script src="options.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,36 +0,0 @@
|
|||
document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
chrome.storage.sync.get(["baseURL", "from", "auth", "sharedID"], (result) => {
|
||||
if (result.baseURL) {
|
||||
document.getElementById("base-url").value = result.baseURL;
|
||||
}
|
||||
if (result.from) {
|
||||
document.getElementById("from").value = result.from;
|
||||
}
|
||||
if (result.auth) {
|
||||
document.getElementById("auth").value = result.auth;
|
||||
}
|
||||
if (result.sharedID) {
|
||||
document.getElementById("shared-id").value = result.sharedID;
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById("save-config").addEventListener("click", () => {
|
||||
const baseURL = document.getElementById("base-url").value;
|
||||
const from = document.getElementById("from").value;
|
||||
const auth = document.getElementById("auth").value;
|
||||
const sharedID = document.getElementById("shared-id").value;
|
||||
|
||||
chrome.storage.sync.set(
|
||||
{
|
||||
baseURL: baseURL,
|
||||
from: from,
|
||||
auth: auth,
|
||||
sharedID: sharedID,
|
||||
},
|
||||
() => {
|
||||
alert("Successfully saved");
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
|
||||
<title>RAGFLOW</title>
|
||||
<link rel="stylesheet" href="styles/popup.css" />
|
||||
</head>
|
||||
|
||||
<body id="ragflow">
|
||||
<div class="window">
|
||||
<textarea id="getHtml"></textarea>
|
||||
<iframe src="" style="width: 100%; height: 100%; min-height: 600px" frameborder="0"></iframe>
|
||||
</div>
|
||||
<script src="popup.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,24 +0,0 @@
|
|||
document.addEventListener("DOMContentLoaded", () => {
|
||||
chrome.storage.sync.get(["baseURL", "from", "auth", "sharedID"], (result) => {
|
||||
if (result.baseURL && result.sharedID && result.from && result.auth) {
|
||||
const iframeSrc = `${result.baseURL}chat/share?shared_id=${result.sharedID}&from=${result.from}&auth=${result.auth}`;
|
||||
const iframe = document.querySelector("iframe");
|
||||
iframe.src = iframeSrc;
|
||||
}
|
||||
});
|
||||
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
|
||||
chrome.scripting.executeScript(
|
||||
{
|
||||
target: { tabId: tabs[0].id },
|
||||
files: ["content.js"],
|
||||
},
|
||||
(results) => {
|
||||
if (results && results[0]) {
|
||||
const getHtml = document.getElementById("getHtml");
|
||||
getHtml.value = results[0].result;
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
|
@ -1,91 +0,0 @@
|
|||
#ragflow {
|
||||
font-family: "Segoe UI", Arial, sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 600px;
|
||||
}
|
||||
|
||||
#ragflow .window {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
#ragflow #form-config {
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#ragflow .header {
|
||||
background-color: #fff;
|
||||
padding: 4px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
#ragflow .header .title {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
#ragflow .header .logo {
|
||||
width: 100px; /* Adjust size as needed */
|
||||
height: auto;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#ragflow .content {
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
#ragflow label {
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
#ragflow input,
|
||||
#ragflow select {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
margin-bottom: 15px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#ragflow button {
|
||||
background-color: #0078d4;
|
||||
color: #fff;
|
||||
padding: 10px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#ragflow button:hover {
|
||||
background-color: #005bb5;
|
||||
}
|
||||
|
||||
#ragflow #config-button {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
font-size: 22px;
|
||||
}
|
||||
#ragflow #config-button:hover {
|
||||
cursor: pointer;
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
#ragflow {
|
||||
font-family: "Segoe UI", Arial, sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 320px;
|
||||
}
|
||||
|
||||
#ragflow .window {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
#ragflow #output {
|
||||
position: absolute;
|
||||
}
|
|
@ -27,12 +27,12 @@ def is_running_in_docker():
|
|||
if is_running_in_docker():
|
||||
MYSQL_HOST = "mysql"
|
||||
MYSQL_PORT = 3306
|
||||
MINIO_HOST = os.getenv("MINIO_VISIT_HOST", "host.docker.internal")
|
||||
MINIO_HOST = "minio"
|
||||
MINIO_PORT = 9000
|
||||
ES_HOST = "es01"
|
||||
ES_PORT = 9200
|
||||
REDIS_HOST = os.getenv("REDIS_HOST", "redis")
|
||||
REDIS_PORT = int(os.getenv("REDIS_PORT", "6379"))
|
||||
REDIS_HOST = "redis"
|
||||
REDIS_PORT = 6379
|
||||
else:
|
||||
MYSQL_HOST = "localhost"
|
||||
MYSQL_PORT = int(os.getenv("MYSQL_PORT", "5455"))
|
||||
|
|
Loading…
Reference in New Issue