refactor: 优化容器连接配置和minio图片访问路径
- 在数据库服务中添加 MINIO_VISIT_HOST 配置,用于指定 MinIO 访问主机 - 修改对话服务和写入服务中生成 MinIO URL 的逻辑,使用新的 visit_point 配置
This commit is contained in:
parent
bee17f7ee2
commit
ed8d7b0075
|
@ -28,6 +28,7 @@ if is_running_in_docker():
|
|||
MYSQL_HOST = "mysql"
|
||||
MYSQL_PORT = 3306
|
||||
MINIO_HOST = "minio"
|
||||
MINIO_VISIT_HOST = "localhost"
|
||||
MINIO_PORT = 9000
|
||||
ES_HOST = "es01"
|
||||
ES_PORT = 9200
|
||||
|
@ -37,6 +38,7 @@ else:
|
|||
MYSQL_HOST = "localhost"
|
||||
MYSQL_PORT = int(os.getenv("MYSQL_PORT", "5455"))
|
||||
MINIO_HOST = "localhost"
|
||||
MINIO_VISIT_HOST = "localhost"
|
||||
MINIO_PORT = int(os.getenv("MINIO_PORT", "9000"))
|
||||
ES_HOST = "localhost"
|
||||
ES_PORT = int(os.getenv("ES_PORT", "9200"))
|
||||
|
@ -59,6 +61,7 @@ MINIO_CONFIG = {
|
|||
"access_key": os.getenv("MINIO_USER", "rag_flow"),
|
||||
"secret_key": os.getenv("MINIO_PASSWORD", "infini_rag_flow"),
|
||||
"secure": False,
|
||||
"visit_point": f"{MINIO_VISIT_HOST}:{MINIO_PORT}",
|
||||
}
|
||||
|
||||
# Elasticsearch连接配置
|
||||
|
|
|
@ -262,7 +262,7 @@ def chat(dialog, messages, stream=True, **kwargs):
|
|||
return match.group(0)
|
||||
|
||||
protocol = "https" if MINIO_CONFIG.get("secure", False) else "http"
|
||||
img_url = f"{protocol}://{MINIO_CONFIG['endpoint']}/{img_path}"
|
||||
img_url = f"{protocol}://{MINIO_CONFIG['visit_point']}/{img_path}"
|
||||
|
||||
if img_url in processed_image_urls:
|
||||
return match.group(0)
|
||||
|
@ -271,7 +271,7 @@ def chat(dialog, messages, stream=True, **kwargs):
|
|||
inserted_images[idx] = img_url
|
||||
|
||||
# 插入图片,不加任何括号包裹引用标记
|
||||
return f"{match.group(0)}\n\n"
|
||||
return f"{match.group(0)}\n\n"
|
||||
|
||||
# 用正则替换插图
|
||||
answer = re.sub(r"##(\d+)\$\$", insert_image_markdown, answer)
|
||||
|
|
|
@ -78,7 +78,7 @@ def write_dialog(question, kb_ids, tenant_id, similarity_threshold, keyword_simi
|
|||
# 流式返回完毕后,追加图片
|
||||
image_markdowns = []
|
||||
image_urls = set()
|
||||
minio_endpoint = MINIO_CONFIG["endpoint"]
|
||||
minio_endpoint = MINIO_CONFIG["visit_point"]
|
||||
use_ssl = MINIO_CONFIG.get("secure", False)
|
||||
protocol = "https" if use_ssl else "http"
|
||||
|
||||
|
|
|
@ -84,11 +84,10 @@ RAGFLOWPLUS_MANAGEMENT_SERVER_IMAGE=zstar1003/ragflowplus-management-server:v0.4
|
|||
TIMEZONE='Asia/Shanghai'
|
||||
|
||||
# Uncomment the following line if you have limited access to huggingface.co:
|
||||
# HF_ENDPOINT=https://hf-mirror.com
|
||||
HF_ENDPOINT=https://hf-mirror.com
|
||||
|
||||
# Optimizations for MacOS
|
||||
# Uncomment the following line if your operating system is MacOS:
|
||||
# MACOS=1
|
||||
# 如果是MacOS,改成MACOS=""
|
||||
MACOS=""
|
||||
|
||||
# 后端允许上传的最大文件大小
|
||||
MAX_CONTENT_LENGTH=10737418240 # 10GB
|
||||
|
|
Loading…
Reference in New Issue