diff --git a/.gitignore b/.gitignore index 0fa9caa..59cbe59 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ src/agent/history/*.db +src/agent/memory/chroma_rag_db/* \ No newline at end of file diff --git a/src/agent/__pycache__/__init__.cpython-312.pyc b/src/agent/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 54b9c69..0000000 Binary files a/src/agent/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/src/agent/__pycache__/chatbot_agent.cpython-312.pyc b/src/agent/__pycache__/chatbot_agent.cpython-312.pyc deleted file mode 100644 index 90def3a..0000000 Binary files a/src/agent/__pycache__/chatbot_agent.cpython-312.pyc and /dev/null differ diff --git a/src/agent/__pycache__/llm.cpython-312.pyc b/src/agent/__pycache__/llm.cpython-312.pyc deleted file mode 100644 index a2a3a65..0000000 Binary files a/src/agent/__pycache__/llm.cpython-312.pyc and /dev/null differ diff --git a/src/agent/__pycache__/llm.cpython-313.pyc b/src/agent/__pycache__/llm.cpython-313.pyc deleted file mode 100644 index 182d0ee..0000000 Binary files a/src/agent/__pycache__/llm.cpython-313.pyc and /dev/null differ diff --git a/src/agent/chatbot_agent.py b/src/agent/chatbot_agent.py index db96ed0..c964e88 100644 --- a/src/agent/chatbot_agent.py +++ b/src/agent/chatbot_agent.py @@ -233,7 +233,7 @@ def execute_agent( last_total_tokens=total_tokens, ) - # TTS 处理(保持原逻辑) + # TTS 处理 output_type_from_config = graph_config.get("metadata", {}).get("output_type", "text") audio_data = llm.last_audio_kwargs or {} if audio_data.get("output_type") != output_type_from_config: diff --git a/src/agent/history/data_base/chat_history.db b/src/agent/history/data_base/chat_history.db index d96b9db..22db556 100644 Binary files a/src/agent/history/data_base/chat_history.db and b/src/agent/history/data_base/chat_history.db differ diff --git a/src/agent/history/multi_inputs/20260527_214854/ui_messages.json b/src/agent/history/multi_inputs/20260527_214854/ui_messages.json new file mode 100644 index 0000000..8f0f73d --- /dev/null +++ b/src/agent/history/multi_inputs/20260527_214854/ui_messages.json @@ -0,0 +1,39 @@ +{ + "version": 2, + "turns": [ + { + "user": { + "content": [ + { + "type": "text", + "text": "赵永顺是谁,简要介绍一下" + } + ] + }, + "assistant": { + "text": "赵永顺通常指的是中国著名的**话剧导演**、**表演艺术家**,也是**北京人民艺术剧院**(北京人艺)的资深导演和演员。\n\n以下是关于他的简要介绍:\n\n1. **身份背景**:他是北京人民艺术剧院的导演、演员,也是中国戏剧家协会会员。他在北京人艺工作多年,是该院艺术创作的中坚力量之一。\n2. **代表作品**:\n * **导演作品**:他执导过多部具有影响力的话剧,包括《天下第一楼》(复排)、《小井胡同》(复排)、《万家灯火》、《全家福》、《玩家》等。其中,《天下第一楼》和《万家灯火》等作品深受观众喜爱,展现了老北京的风土人情和时代变迁。\n * **表演作品**:作为演员,他也曾在多部人艺经典剧目中担任重要角色,如《茶馆》、《雷雨》等。\n3. **艺术风格**:赵永顺的导演风格细腻、严谨,擅长挖掘人物内心,注重舞台调度的生活化和真实感。他继承和发扬了北京人艺“现实主义”的优良传统,致力于塑造鲜活、立体的中国老百姓形象。\n4. **贡献**:他在传承北京人艺艺术风格、培养青年演员以及推动中国话剧发展方面做出了重要贡献。\n\n*注:如果您查询的是其他同名人物(如某位学者、地方官员或特定领域的专家),请提供更多背景信息,以便我进行更精准的查询。*", + "output_type": "text", + "autoplay": false, + "audio_duration_seconds": null, + "audio_relpath": null + } + }, + { + "user": { + "content": [ + { + "type": "text", + "text": "去rag库中找一下赵永顺的信息再回复我" + } + ] + }, + "assistant": { + "text": "根据您提供的截图(`chatbot_agent` 编排流程图)以及RAG库中检索到的信息,这里的“赵永顺”并非指北京人艺的导演,而是**山东大学信息科学与工程学院的一位优秀学生**。\n\n以下是基于RAG库内容的详细介绍:\n\n**1. 基本身份**\n* **姓名**:赵永顺\n* **院校/专业**:山东大学(青岛)信息科学与工程学院,2022级**电子科学与技术**专业本科生。\n* **核心标签**:顶尖学术型、**双国奖得主**(连续两年获得国家奖学金)、学生工作骨干。\n\n**2. 学业与荣誉**\n* **学业表现**:专业排名前列,是学院“榜样的力量”学院榜样人物。\n* **核心荣誉**:\n * 2023—2024、2024—2025 连续两年获得**国家奖学金**。\n * 2025年青岛市千名优秀大学生。\n * 信息学院优秀共青团员。\n* **专业方向**:电子电路基础、半导体物理扎实,适配半导体、微电子、集成电路方向。\n\n**3. 能力与特质**\n* **硬技能**:掌握C/C++、Python、数据处理、学术文档撰写及科研辅助实验。\n* **软技能**:严谨自律、执行力强、沟通高效、抗压能力强。\n* **性格**:沉稳务实、目标导向、低调肯干,属于典型的“科研/技术潜力股”。\n\n**4. 近期动态与项目(结合截图信息)**\n* **项目参与**:根据截图内容,赵永顺近期正在参与 **chatbot_agent**(智能体)的**RAG(检索增强生成)开发测试**。\n * 该截图详细展示了该Agent的架构,包括用户层(Gradio/FastAPI)、核心编排逻辑(图片处理、上下文记忆管理、历史摘要)、以及持久化存储(SQLite)。\n * 这表明他具备较强的工程落地能力和对前沿AI技术(如多模态处理、LangChain编排)的掌握。\n* **行程安排**:\n * 近期计划包括解决代码Bug、模型训练、参数调优等**技术攻坚**工作。\n * 正在完善论文结构、制作答辩PPT,准备**学术输出**。\n * 曾计划与曾嘉翔、朱振宁、刘殿阳等同学进行成果分享会。\n\n**总结**\n这里的赵永顺是一位在**微电子/半导体**领域有深厚积累,同时具备**AI工程开发能力**的山东大学顶尖本科生。他不仅在学术上成绩斐然(双国奖),还积极投身于具体的技术研发项目(如截图中的chatbot_agent系统开发),是典型的复合型技术人才。", + "output_type": "text", + "autoplay": false, + "audio_duration_seconds": null, + "audio_relpath": null + } + } + ] +} \ No newline at end of file diff --git a/src/agent/history/multi_inputs/20260527_215121/ui_messages.json b/src/agent/history/multi_inputs/20260527_215121/ui_messages.json new file mode 100644 index 0000000..09754ba --- /dev/null +++ b/src/agent/history/multi_inputs/20260527_215121/ui_messages.json @@ -0,0 +1,49 @@ +{ + "version": 2, + "turns": [ + { + "user": { + "content": [ + { + "type": "file", + "relpath": "20260527_215121/英语演讲——我的故事_20260527_215121_1.pdf", + "name": "英语演讲——我的故事.pdf" + }, + { + "type": "text", + "text": "帮我再精简一下" + } + ] + }, + "assistant": { + "text": "这份演讲稿的核心情感非常真挚,但在语法、用词准确性和口语流畅度上还有提升空间。原稿中存在一些中式英语表达(如 \"throw reading\" 应为 \"through reading\")、重复用词以及部分句子结构松散的问题。\n\n以下是为您精简并润色后的版本,保留了原意,但语言更地道、有力,更适合演讲:\n\n### 精简润色版 (Polished & Concise Version)\n\n**Title: My Story and the Chinese Dream**\n\nGood morning, everyone.\n\nIf you ask me, \"What is the Chinese Dream?\" I would tell you: \"It is a dream belonging to all Chinese people.\"\n\nIt may seem distant, but let me explain it through my own story.\n\nI come from Liaocheng, once one of the poorest cities in Shandong. Growing up, we were told to be shrewd and vigilant because survival was a daily struggle. While city children were reading and writing, we farmers' kids spent our days working in the fields. We wanted to change our lives through education, but the opportunity was out of reach. Back then, my only dream was to leave and never return.\n\nHowever, things have changed. Today, our country encourages young people to return home and contribute. Success stories are bringing knowledge and hope back to our hometowns. Although I am away now, I will return again and again to dedicate my strength, my heart, and everything I have to make my hometown better. As the saying goes, \"He who has been through the rain wants to hold an umbrella for others.\"\n\nA profound realization has hit me: the ground beneath us is our hometown, called **China**. The dream within us is our dream, called the **Chinese Dream**.\n\nDo you see it? The Chinese Dream is neither mysterious nor distant. Unlike the self-serving actions some nations have taken in the name of democracy, our dream is simple: to widen our roads, clear our skies, refresh our air, and bring happiness to our people.\n\nThis is the Chinese Dream in my heart: a dream of peace and harmony. And it is a dream shared by people all over the world.\n\nThank you.\n\n---\n\n### 主要修改点说明 (Key Changes):\n\n1. **修正语法与拼写**:\n * \"throw reading\" -> \"through education\" (更正式且准确)。\n * \"cit ies\" -> \"cities\", \"glib\" (圆滑通常含贬义) -> \"shrewd\" (精明) 或直接调整语境。\n * \"donate my body, my blood...\" -> \"dedicate my strength, my heart...\" (原表达在英语中听起来过于血腥或医疗化,改为“奉献”更得体)。\n\n2. **提升流畅度与节奏**:\n * 将 \"never never never back again\" 简化为 \"never return\",在演讲中更有力。\n * 将 \"More and more people who succeed in their domains...\" 简化为 \"Success stories are bringing...\",减少冗余。\n\n3. **优化对比表达**:\n * 关于美国/西方的部分,原句 \"in Garza\" 可能是拼写错误或指代不明(可能是指 Gaza 加沙,或者是特定的地缘政治事件,但在演讲中容易引发歧义或过于具体)。修改版将其概括为 \"self-serving actions some nations have taken...\",既保留了原意(反对以民主自由为名的损人利己),又让表达更通用、安全且有力。\n\n4. **强化结尾**:\n * 将 \"road wider, sky bluer...\" 的排比句保留并理顺,使其朗朗上口。\n\n这个版本更适合口语表达,听众更容易抓住重点,同时保留了演讲者从贫困到奋斗再到回馈家乡的感人逻辑。", + "output_type": "text", + "autoplay": false, + "audio_duration_seconds": null, + "audio_relpath": null + } + }, + { + "user": { + "content": [ + { + "type": "image_url", + "relpath": "20260527_215121/后端建议_20260527_215121_1.png", + "name": "后端建议.png" + }, + { + "type": "text", + "text": "帮我总结一下这张图片的内容" + } + ] + }, + "assistant": { + "text": "这张图片是一份关于**后端编程语言推荐**的个人建议清单,内容如下:\n\n**标题**:后端编程语言推荐 \n**副标题**:以下仅代表我个人建议\n\n**具体建议**:\n\n1. **Java**:如果你打算未来深耕 Web 后端开发,推荐选择 Java。理由是 Java 在国内 Web 开发领域的地位非常稳固,难以撼动。\n2. **Node.js**:如果你是前端程序员,想转行做后端,推荐选择 Node.js(因为前后端技术栈接近,上手快)。\n3. **Python**:除上述两种情况外,其他场景都推荐 Python。其最大优点是**简单、效率高**。\n4. **PHP**:明确建议“千万不要学 PHP”,表达了一种强烈的否定态度。\n\n✅ 总结: \n这是一份带有强烈个人倾向的后端语言选择指南,核心逻辑是:\n- 想稳扎稳打做企业级 Web 后端 → 选 Java;\n- 前端转后端 → 选 Node.js;\n- 其他通用或快速开发场景 → 选 Python;\n- PHP → 不推荐。\n\n⚠️ 注意:图中明确标注“仅代表我个人建议”,说明这不是权威结论,而是作者基于自身经验或市场观察给出的主观推荐。\n\n(注:虽然图中未提及 Go、C#、Rust 等现代后端语言,但这是“个人建议”,并非全面技术选型指南。)", + "output_type": "text", + "autoplay": false, + "audio_duration_seconds": null, + "audio_relpath": null + } + } + ] +} \ No newline at end of file diff --git a/src/agent/history/multi_inputs/20260527_215121/后端建议_20260527_215121_1.png b/src/agent/history/multi_inputs/20260527_215121/后端建议_20260527_215121_1.png new file mode 100644 index 0000000..4847cb5 Binary files /dev/null and b/src/agent/history/multi_inputs/20260527_215121/后端建议_20260527_215121_1.png differ diff --git a/src/agent/history/multi_inputs/20260527_215121/英语演讲——我的故事_20260527_215121_1.pdf b/src/agent/history/multi_inputs/20260527_215121/英语演讲——我的故事_20260527_215121_1.pdf new file mode 100644 index 0000000..0ccc36f Binary files /dev/null and b/src/agent/history/multi_inputs/20260527_215121/英语演讲——我的故事_20260527_215121_1.pdf differ diff --git a/src/agent/history/multi_inputs/20260527_215307/22级-25年优秀学生干部_20260527_215307_1.xlsx b/src/agent/history/multi_inputs/20260527_215307/22级-25年优秀学生干部_20260527_215307_1.xlsx new file mode 100644 index 0000000..8cdc84e Binary files /dev/null and b/src/agent/history/multi_inputs/20260527_215307/22级-25年优秀学生干部_20260527_215307_1.xlsx differ diff --git a/src/agent/history/multi_inputs/20260527_215307/ui_messages.json b/src/agent/history/multi_inputs/20260527_215307/ui_messages.json new file mode 100644 index 0000000..9da7e4e --- /dev/null +++ b/src/agent/history/multi_inputs/20260527_215307/ui_messages.json @@ -0,0 +1,27 @@ +{ + "version": 2, + "turns": [ + { + "user": { + "content": [ + { + "type": "file", + "relpath": "20260527_215307/22级-25年优秀学生干部_20260527_215307_1.xlsx", + "name": "22级-25年优秀学生干部.xlsx" + }, + { + "type": "text", + "text": "帮我提取内容并加以说明" + } + ] + }, + "assistant": { + "text": "这份文件是一份关于**22级学生评选2025年优秀学生干部**的名单汇总表。\n\n### 📋 内容提取与整理\n\n该表格共包含9个班级/项目,每个单位评选出了一名**校级**优秀学生干部和一名**院级**优秀学生干部。具体名单如下:\n\n| 班级/项目 | 校级优秀学生干部 | 院级优秀学生干部 |\n| :--- | :--- | :--- |\n| **通信一班** | 刘和宝 | 郭思宇 |\n| **通信二班** | 董卓然 | 王雨萌 |\n| **通信三班** | 朱洪亿 | 李爽爽 |\n| **电科一班** | 李皓威 | 邱浩原 |\n| **电科二班** | 赵永顺 | 王子瑶 |\n| **光信** | 纪天泽 | 温致涵 |\n| **光创** | 王志成 | 曹晶晶 |\n| **微纳** | 王隆昊 | 张加祥 |\n| **崇新** | 庞开升 | 刘希言 |\n\n---\n\n### 💡 说明与分析\n\n1. **评选层级**:\n * **校级**:代表该班级/项目中最优秀的学生干部,将代表学院参加学校层面的评选或表彰。\n * **院级**:代表学院内部评选出的优秀学生干部,是校级评选的后备或并列荣誉。\n\n2. **涉及专业/班级**:\n * 名单涵盖了**通信工程**(分三个班)、**电子信息科学与技术**(分两个班)以及**光电信息**相关方向(光信、光创、微纳、崇新等创新班或项目班)。这表明该评选主要面向电子信息类相关专业的大二学生(22级)。\n\n3. **文件命名含义**:\n * `22级-25年优秀学生干部`:表明这是针对2022级入学学生,在2025年进行的优秀学生干部评选(通常评选周期可能跨越学年,或指2025年度的荣誉)。\n * `20260527_215307`:文件生成的时间戳显示为 **2026年5月27日 21:53:07**。这暗示该文件可能是基于未来时间设定的模拟数据,或者是系统时间设置在未来/测试环境下的产物。\n\n4. **数据用途**:\n * 该表格通常用于公示评选结果、录入教务系统、制作荣誉证书或作为档案留存。\n\n如果您需要将这些数据转换为特定的格式(如CSV、JSON)或进行统计分析,请随时告诉我!", + "output_type": "text", + "autoplay": false, + "audio_duration_seconds": null, + "audio_relpath": null + } + } + ] +} \ No newline at end of file diff --git a/src/agent/memory/__pycache__/__init__.cpython-312.pyc b/src/agent/memory/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 318af58..0000000 Binary files a/src/agent/memory/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/src/agent/memory/__pycache__/system_prompt.cpython-312.pyc b/src/agent/memory/__pycache__/system_prompt.cpython-312.pyc deleted file mode 100644 index 0bfd68a..0000000 Binary files a/src/agent/memory/__pycache__/system_prompt.cpython-312.pyc and /dev/null differ diff --git a/src/agent/memory/chroma_rag_db/93b83aa9-b3da-41a4-b34c-90fcd21bda19/data_level0.bin b/src/agent/memory/chroma_rag_db/93b83aa9-b3da-41a4-b34c-90fcd21bda19/data_level0.bin index b3f8c53..5e59e28 100644 Binary files a/src/agent/memory/chroma_rag_db/93b83aa9-b3da-41a4-b34c-90fcd21bda19/data_level0.bin and b/src/agent/memory/chroma_rag_db/93b83aa9-b3da-41a4-b34c-90fcd21bda19/data_level0.bin differ diff --git a/src/agent/memory/chroma_rag_db/93b83aa9-b3da-41a4-b34c-90fcd21bda19/length.bin b/src/agent/memory/chroma_rag_db/93b83aa9-b3da-41a4-b34c-90fcd21bda19/length.bin index 83f0686..804579b 100644 Binary files a/src/agent/memory/chroma_rag_db/93b83aa9-b3da-41a4-b34c-90fcd21bda19/length.bin and b/src/agent/memory/chroma_rag_db/93b83aa9-b3da-41a4-b34c-90fcd21bda19/length.bin differ diff --git a/src/agent/memory/chroma_rag_db/chroma.sqlite3 b/src/agent/memory/chroma_rag_db/chroma.sqlite3 index 57f28d4..ffecd46 100644 Binary files a/src/agent/memory/chroma_rag_db/chroma.sqlite3 and b/src/agent/memory/chroma_rag_db/chroma.sqlite3 differ diff --git a/src/agent/tools/__init__.py b/src/agent/tools/__init__.py index d4f507b..82ff8de 100644 --- a/src/agent/tools/__init__.py +++ b/src/agent/tools/__init__.py @@ -1,7 +1,7 @@ from .tool import * from .tool_rag import RAGTool -# from .tool_database_class import * +# from .tool_database import * # from utils.database_utils import PostgreSQL_Manager # 创建数据库管理器实例 diff --git a/src/agent/tools/__pycache__/__init__.cpython-312.pyc b/src/agent/tools/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index a6bb083..0000000 Binary files a/src/agent/tools/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/src/agent/tools/__pycache__/tool.cpython-312.pyc b/src/agent/tools/__pycache__/tool.cpython-312.pyc deleted file mode 100644 index a3b68b7..0000000 Binary files a/src/agent/tools/__pycache__/tool.cpython-312.pyc and /dev/null differ diff --git a/src/agent/tools/__pycache__/tool_rag.cpython-312.pyc b/src/agent/tools/__pycache__/tool_rag.cpython-312.pyc deleted file mode 100644 index a120e87..0000000 Binary files a/src/agent/tools/__pycache__/tool_rag.cpython-312.pyc and /dev/null differ diff --git a/src/agent/tools/tool_database_class.py b/src/agent/tools/tool_database.py similarity index 100% rename from src/agent/tools/tool_database_class.py rename to src/agent/tools/tool_database.py diff --git a/src/agent/utils/__pycache__/__init__.cpython-312.pyc b/src/agent/utils/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index c72cf9f..0000000 Binary files a/src/agent/utils/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/src/agent/utils/__pycache__/agent_utils.cpython-312.pyc b/src/agent/utils/__pycache__/agent_utils.cpython-312.pyc deleted file mode 100644 index 74782b5..0000000 Binary files a/src/agent/utils/__pycache__/agent_utils.cpython-312.pyc and /dev/null differ diff --git a/src/agent/utils/__pycache__/env_utils.cpython-312.pyc b/src/agent/utils/__pycache__/env_utils.cpython-312.pyc deleted file mode 100644 index 7c78584..0000000 Binary files a/src/agent/utils/__pycache__/env_utils.cpython-312.pyc and /dev/null differ diff --git a/src/agent/utils/__pycache__/image_utils.cpython-312.pyc b/src/agent/utils/__pycache__/image_utils.cpython-312.pyc deleted file mode 100644 index 00adb64..0000000 Binary files a/src/agent/utils/__pycache__/image_utils.cpython-312.pyc and /dev/null differ diff --git a/src/web/__pycache__/__init__.cpython-312.pyc b/src/web/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 0065abe..0000000 Binary files a/src/web/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/src/web/__pycache__/server.cpython-312.pyc b/src/web/__pycache__/server.cpython-312.pyc deleted file mode 100644 index 9592cae..0000000 Binary files a/src/web/__pycache__/server.cpython-312.pyc and /dev/null differ diff --git a/src/web/__pycache__/server.cpython-313.pyc b/src/web/__pycache__/server.cpython-313.pyc deleted file mode 100644 index 3575862..0000000 Binary files a/src/web/__pycache__/server.cpython-313.pyc and /dev/null differ diff --git a/src/web/__pycache__/ui_session.cpython-312.pyc b/src/web/__pycache__/ui_session.cpython-312.pyc deleted file mode 100644 index ae1e597..0000000 Binary files a/src/web/__pycache__/ui_session.cpython-312.pyc and /dev/null differ diff --git a/src/web/__pycache__/ui_session.cpython-313.pyc b/src/web/__pycache__/ui_session.cpython-313.pyc deleted file mode 100644 index fed1c4c..0000000 Binary files a/src/web/__pycache__/ui_session.cpython-313.pyc and /dev/null differ