12345678910111213141516171819 |
- import time
- from module.qa_chain import QAChain
- if __name__ == "__main__":
- # 使用自定义配置文件
- custom_config = "config/qa_config.json"
- custom_chain = QAChain(config_path=custom_config)
- try:
- while True:
- question = input("请输入问题: ")
- if question == "exit":
- break
- start = time.time()
- result = custom_chain.invoke({"question": question})
- print(f"回答: {result['answer']}")
- print(f"耗时: {time.time() - start} 秒")
- except Exception as e:
- print(f"自定义配置处理失败: {e}")
|