feat: 完成资源接入
This commit is contained in:
@@ -15,24 +15,28 @@ class ClarifyNode(BaseNode):
|
||||
name = "clarify_node"
|
||||
|
||||
async def process(self, state: QueryState) -> QueryState:
|
||||
updated_state: QueryState = state.copy()
|
||||
intent = state["intent"]
|
||||
print(intent)
|
||||
print("=================")
|
||||
|
||||
payload = {
|
||||
"intent": intent,
|
||||
"input_context": state["input_context"].model_dump(mode="json"),
|
||||
}
|
||||
|
||||
if intent != "unclear":
|
||||
# 以需求节点的问题为依据补齐选项,不重新判断意图
|
||||
payload["requirement"] = state["requirement"].model_dump(mode="json")
|
||||
llm = get_llm(Clarification)
|
||||
clarification = await llm.ainvoke(
|
||||
|
||||
llm_client = get_llm(Clarification)
|
||||
clarification = await llm_client.ainvoke(
|
||||
[
|
||||
SystemMessage(content=CLARIFY_SYSTEM_PROMPT),
|
||||
HumanMessage(content=json.dumps(payload, ensure_ascii=False)),
|
||||
]
|
||||
)
|
||||
return {**state, "clarification": clarification}
|
||||
|
||||
updated_state["clarification"] = clarification
|
||||
return updated_state
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user