[RAG] 全部LLM硬编码从deepseek-r1改为deepseek-v3;修复知识库问答source格式不匹配导致检索结果被丢弃

This commit is contained in:
2026-04-07 10:32:14 +08:00
parent 4e00a1b15e
commit a5110da4e8
12 changed files with 18 additions and 17 deletions

View File

@@ -62,7 +62,7 @@ async def chat(query: str = Body(..., description="用户输入", examples=["恼
if prompt_name == "Search Summary":
model = get_ChatOpenAI(
model_name=LLM_MODELS[1],
model_name=LLM_MODELS[0],
temperature=temperature,
max_tokens=max_tokens,
callbacks=callbacks,

View File

@@ -46,7 +46,7 @@ async def chat_comparison_test(
executor.submit(
get_llm_model_response,
strategy_name="query rewrite",
llm_model_name=LLM_MODELS[1],
llm_model_name=LLM_MODELS[0],
template_prompt_name="extract_key_points",
prompt_param_dict={"time": datetime.now().strftime("%Y%m%d"), "context": context, "content": content},
temperature=0.01,

View File

@@ -44,7 +44,7 @@ async def gen_abstract(
try:
article_abstract = get_llm_model_response(
strategy_name="gen_abstract",
llm_model_name=LLM_MODELS[1],
llm_model_name=LLM_MODELS[0],
template_prompt_name="gen_abstract",
prompt_param_dict={
"context": context_summary, # 使用摘要或原文

View File

@@ -44,7 +44,7 @@ async def gen_conclusion(
try:
article_conclusion = get_llm_model_response(
strategy_name="gen_conclusion",
llm_model_name=LLM_MODELS[1],
llm_model_name=LLM_MODELS[0],
template_prompt_name="gen_conclusion",
prompt_param_dict={
"context": context_summary, # 使用摘要或原文

View File

@@ -43,7 +43,7 @@ async def gen_keywords(
try:
article_keywords = get_llm_model_response(
strategy_name="gen_keywords",
llm_model_name=LLM_MODELS[1],
llm_model_name=LLM_MODELS[0],
template_prompt_name="gen_keywords",
prompt_param_dict={
"context": context_summary, # 使用摘要或原文

View File

@@ -44,7 +44,7 @@ async def gen_paragraph(
try:
article_paragraph = get_llm_model_response(
strategy_name="gen_paragraph",
llm_model_name=LLM_MODELS[1],
llm_model_name=LLM_MODELS[0],
template_prompt_name="gen_paragraph",
prompt_param_dict={
"context": context_summary, # 使用摘要或原文

View File

@@ -19,7 +19,7 @@ async def gen_title(
"content": "我们来玩成语接龙,我先来,生龙活虎"},
{"role": "assistant", "content": "虎头虎脑"}]]
),
model_name: Optional[str] = Body(LLM_MODELS[1], description="LLM 模型名称。"),
model_name: Optional[str] = Body(LLM_MODELS[0], description="LLM 模型名称。"),
):
"""
根据一轮对话历史生成简洁标题\n
@@ -32,7 +32,7 @@ async def gen_title(
if model_name == "R1-70B":
model_name = DEEPSEEK_MODELS[1]
elif model_name == "QIANWEN":
model_name = LLM_MODELS[1]
model_name = LLM_MODELS[0]
else:
model_name = model_name

View File

@@ -138,7 +138,7 @@ async def knowledge_base_chat(query: str = Body(..., description="用户输入",
if isinstance(max_tokens, int) and max_tokens <= 0:
max_tokens = None
if prompt_name == "policy_chat":
model_name = LLM_MODELS[1]
model_name = LLM_MODELS[0]
model = get_ChatOpenAI(
model_name=model_name,
temperature=temperature,

View File

@@ -364,7 +364,7 @@ async def search_engine_chat(uid: Optional[str]=Body(None, description="userID")
"content": "虎头虎脑"}]]
),
stream: bool = Body(False, description="流式输出"),
model_name: str = Body(LLM_MODELS[1], description="LLM 模型名称。"),
model_name: str = Body(LLM_MODELS[0], description="LLM 模型名称。"),
temperature: float = Body(TEMPERATURE, description="LLM 采样温度", ge=0.0, le=1.0),
max_tokens: Optional[int] = Body(None, description="限制LLM生成Token数量默认None代表模型最大值"),
prompt_name: str = Body("default",
@@ -483,7 +483,7 @@ async def search_engine_chat(uid: Optional[str]=Body(None, description="userID")
search_engine_name: str,
top_k: int,
history: Optional[List[History]],
model_name: str = LLM_MODELS[1],
model_name: str = LLM_MODELS[0],
prompt_name: str = prompt_name,
kgo_search_type: str = kgo_search_type
) -> AsyncIterable[str]:

View File

@@ -72,7 +72,7 @@ async def self_kb_chat(
async def knowledge_base_chat_iterator(
query: str,
model_name: str = LLM_MODELS[0],
model_name1: str = LLM_MODELS[1],
model_name1: str = LLM_MODELS[0],
prompt_name: str = "self_default",
) -> AsyncIterable[str]:
nonlocal fileNames, history