Python/产品需求文档AI生成/main copy.py

30 lines
624 B
Python

# -*- coding: utf-8 -*-
"""
主运行模块
"""
# 列举导入模块
import asyncio
from utils.agent import BaseAgent
# 主函数
async def main():
print("进入会话模式,输入 exit 结束会话")
# 实例智能体
agent = BaseAgent(instructions="请用一句话简洁回复。")
while True:
user_prompt = input("用户:").strip().lower()
if user_prompt == "exit":
print("会话结束")
break
result = await agent.run(user_prompt=user_prompt)
print("智能体:", result.output)
if __name__ == "__main__":
asyncio.run(main=main())