| 1234567891011121314151617181920212223 |
- from .chain import create_chat_agent
- from .config import load_config
- def run_chat() -> None:
- config = load_config()
- agent = create_chat_agent(config)
- run_config = {"configurable": {"thread_id": config.default_session_id}}
- while True:
- question = input("请输入: ").strip()
- if not question:
- continue
- if question.lower() in ["exit", "quit", "q"]:
- break
- result = agent.invoke(
- {"messages": [{"role": "user", "content": question}]},
- config=run_config,
- )
- answer = result["messages"][-1].content
- print(f"AI: {answer}")
|