This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
from langchain_core.runnables.config import RunnableConfig
|
||||
|
||||
from ..state import MainGraphState
|
||||
from ...logger import info, debug
|
||||
@@ -28,7 +29,7 @@ CHITCHAT_KEYWORDS = {
|
||||
|
||||
|
||||
# ========== 闲聊节点 ==========
|
||||
async def fast_chitchat_node(state: MainGraphState, config: Optional[dict] = None) -> MainGraphState:
|
||||
async def fast_chitchat_node(state: MainGraphState, config: Optional[RunnableConfig] = None) -> MainGraphState:
|
||||
"""快速闲聊节点"""
|
||||
state.current_phase = "fast_chitchat"
|
||||
query = state.user_query or ""
|
||||
@@ -69,14 +70,14 @@ def _match_chitchat_template(query: str) -> str:
|
||||
|
||||
|
||||
# ========== 快速 RAG 节点 ==========
|
||||
async def fast_rag_node(state: MainGraphState, config: Optional[dict] = None) -> MainGraphState:
|
||||
async def fast_rag_node(state: MainGraphState, config: Optional[RunnableConfig] = None) -> MainGraphState:
|
||||
"""快速 RAG 节点:只负责 RAG 检索,然后交给 llm_call 生成回答"""
|
||||
state.current_phase = "fast_rag"
|
||||
query = state.user_query or ""
|
||||
info(f"[Fast RAG] 开始处理: {query[:50]}")
|
||||
|
||||
# 获取 RAG 工具
|
||||
from app.main_graph.utils.rag_initializer import get_rag_tool
|
||||
from backend.app.main_graph.utils.rag_initializer import get_rag_tool
|
||||
rag_tool = get_rag_tool()
|
||||
info(f"[Fast RAG] 获取到 rag_tool: {rag_tool is not None}")
|
||||
|
||||
@@ -134,7 +135,7 @@ async def _generate_fast_answer(state: MainGraphState, query: str) -> MainGraphS
|
||||
请给出简洁、准确的回答:"""
|
||||
|
||||
# 使用流式输出
|
||||
from app.main_graph.config import get_stream_writer
|
||||
from backend.app.main_graph.config import get_stream_writer
|
||||
writer = get_stream_writer()
|
||||
|
||||
full_content = ""
|
||||
@@ -164,7 +165,7 @@ async def _generate_fast_answer(state: MainGraphState, query: str) -> MainGraphS
|
||||
|
||||
|
||||
# ========== 快速工具节点 ==========
|
||||
async def fast_tool_node(state: MainGraphState, config: Optional[dict] = None) -> MainGraphState:
|
||||
async def fast_tool_node(state: MainGraphState, config: Optional[RunnableConfig] = None) -> MainGraphState:
|
||||
"""快速工具节点"""
|
||||
state.current_phase = "fast_tool"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user