refactor(write): 文档撰写模式修改生图逻辑,适配 PR#154 的修改
This commit is contained in:
parent
180443bfbf
commit
e3e68f1006
|
@ -102,7 +102,7 @@ ollama pull bge-m3:latest
|
|||
访问地址:`服务器ip:8888`,进入到后台管理界面
|
||||
|
||||
|
||||
#### 2. 源码运行(mysql、minio、es等组件仍需docker启动)
|
||||
#### 2. 源码运行(mysql、minio、es、redis等组件仍需docker启动)
|
||||
|
||||
1. 启动后台管理系统:
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ Access the admin dashboard at: `your-server-ip:8888`
|
|||
|
||||
📘 Step-by-step tutorial: [https://blog.csdn.net/qq1198768105/article/details/147475488](https://blog.csdn.net/qq1198768105/article/details/147475488)
|
||||
|
||||
#### 2. Run from Source Code (Docker is still required for MySQL, MinIO, Elasticsearch, etc.)
|
||||
#### 2. Run from Source Code (Docker is still required for MySQL, MinIO, Elasticsearch, Redis, etc.)
|
||||
|
||||
1. Start the Admin System:
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ from api.db.services.llm_service import LLMBundle
|
|||
from api import settings
|
||||
from rag.app.tag import label_question
|
||||
from rag.prompts import kb_prompt
|
||||
from .database import MINIO_CONFIG
|
||||
|
||||
|
||||
def write_dialog(question, kb_ids, tenant_id, similarity_threshold, keyword_similarity_weight, temperature):
|
||||
|
@ -77,9 +78,19 @@ def write_dialog(question, kb_ids, tenant_id, similarity_threshold, keyword_simi
|
|||
# 流式返回完毕后,追加图片
|
||||
image_markdowns = []
|
||||
image_urls = set()
|
||||
minio_endpoint = MINIO_CONFIG["endpoint"]
|
||||
use_ssl = MINIO_CONFIG.get("secure", False)
|
||||
protocol = "https" if use_ssl else "http"
|
||||
|
||||
for chunk in kbinfos["chunks"]:
|
||||
img_url = chunk.get("image_id")
|
||||
if img_url and img_url not in image_urls:
|
||||
img_path = chunk.get("image_id")
|
||||
if not img_path:
|
||||
continue
|
||||
|
||||
img_path = img_path.strip() # 清理前后空格
|
||||
img_url = f"{protocol}://{minio_endpoint}/{img_path}"
|
||||
|
||||
if img_url not in image_urls:
|
||||
image_urls.add(img_url)
|
||||
image_markdowns.append(f"\n")
|
||||
|
||||
|
|
Loading…
Reference in New Issue