feat: restore source parity and harden agent runtime
This commit is contained in:
@@ -570,7 +570,7 @@ class ConfirmNode(BaseNode):
|
||||
|
||||
return False, False
|
||||
|
||||
def _llm_intent_recognition(self, user_input: str, context_content: str, model_id: str) -> bool:
|
||||
def _llm_intent_recognition(self, user_input: str, context_content: str, model_id: str, db_session=None) -> bool:
|
||||
"""
|
||||
使用 LLM 进行意图识别
|
||||
|
||||
@@ -595,7 +595,7 @@ class ConfirmNode(BaseNode):
|
||||
|
||||
请判断用户意图:"""
|
||||
|
||||
llm_service = LLMService()
|
||||
llm_service = LLMService(db_session)
|
||||
response = llm_service.chat(
|
||||
model_id=model_id,
|
||||
messages=[
|
||||
@@ -639,7 +639,9 @@ class ConfirmNode(BaseNode):
|
||||
if not matched and use_llm_intent and llm_model_id:
|
||||
# 关键词未匹配,使用 LLM 意图识别
|
||||
logger.info(f'关键词未匹配,使用 LLM 意图识别: {user_input}')
|
||||
confirmed = self._llm_intent_recognition(str(user_input), content, llm_model_id)
|
||||
confirmed = self._llm_intent_recognition(
|
||||
str(user_input), content, llm_model_id, context.db_session
|
||||
)
|
||||
elif not matched:
|
||||
# 关键词未匹配且未启用 LLM,默认为取消
|
||||
logger.info(f'关键词未匹配,默认取消: {user_input}')
|
||||
|
||||
Reference in New Issue
Block a user