Skip to content

Pythia#51

Merged
smartmita merged 221 commits intodevfrom
pythia
Sep 13, 2025
Merged

Pythia#51
smartmita merged 221 commits intodevfrom
pythia

Conversation

@smartmita
Copy link
Collaborator

No description provided.

Dax233 and others added 30 commits August 12, 2025 21:48
- Updated string quotes for consistency in chat_session.py and chat_session_manager.py.
- Added new environment variables for TypeDB configuration in template.env.
- Created new test files for TypeDB services including action_log_storage_service, entity_graph_service, event_storage_service, goal_storage_service, image_analysis_cache_service, sticker_storage_service, summary_storage_service, and thought_storage_service.
- Implemented unit tests for various functionalities in the newly created test files, ensuring proper mocking and assertions.
- Enhanced existing services with better error handling and logging.
…cker, summary, and thought storage

- Deleted EventStorageService, GoalStorageService, ImageAnalysisCacheService, StickerStorageService, SummaryStorageService, and ThoughtStorageService.
- Updated ImageAnalysisService to use TypeDBConnectionManager instead of ArangoDBConnectionManager.
- Adjusted tests to mock asyncio.to_thread for GoalStorageService and ImageAnalysisCacheService.
…and enhance event storage service for IIS model training
… use the correct syntax and improve code consistency
Refactor database schema and services

- Updated schema definitions in `schema.tql` to improve clarity and consistency, including renaming long types to integer and removing unnecessary ownerships.
- Adjusted import statements in various service files for better organization and readability.
- Enhanced `ActionLogStorageService`, `EntityGraphService`, `EventStorageService`, `GoalStorageService`, `ImageAnalysisCacheService`, `StickerStorageService`, `SummaryStorageService`, and `ThoughtStorageService` to ensure correct transaction handling and improved error logging.
- Removed outdated documentation file `mention.md` to streamline the codebase.
- Improved hash generation for images in `DefaultMessageProcessor` for better event handling.
…, improve error handling, and enhance entity management.

- Updated EntityGraphService to inject EventStorageService and handle entity creation and updates more efficiently.
- Enhanced EventStorageService with methods for fetching events by timestamp and counting unread messages.
- Removed redundant 'get' clauses from various database service queries to streamline data retrieval.
- Improved error logging and handling across services for better debugging and maintenance.
- Added new methods in EventStorageService for managing event documents and integrating with EntityGraphService.
… thought storage services

- Simplified test structures by removing unnecessary mocks and fixtures.
- Enhanced test coverage for saving, finding, and updating events in EventStorageService.
- Updated goal storage tests to include adding and loading goals.
- Improved image analysis cache tests for saving and retrieving analysis results.
- Streamlined sticker storage tests to cover the full lifecycle of stickers.
- Refined summary storage tests to validate saving summaries with actual database interactions.
- Enhanced thought storage tests to validate saving and linking thought chains effectively.
为群聊更新逻辑添加错误处理,并优化 TypeDB 的成员关系更新查询
smartmita and others added 20 commits September 8, 2025 15:03
- Introduced QQStickerService to handle all sticker-related logic for the QQ platform, replacing the previous StickerService.
- Updated ActionHandler to route sticker management actions to the new QQStickerService.
- Modified MessageBuilder to utilize QQStickerService for sending stickers.
- Refactored methods in ThoughtPromptBuilder to support asynchronous operations for building response schemas.
- Enhanced handle_os_interaction to pass thought_key to ActionHandler.
- Updated the get_action_definitions method in BaseAppBuilder to accept a ServiceContainer.
- Removed the old StickerService implementation and integrated its functionality into QQStickerService.
- Added error handling and logging improvements across various modules.
…平台ID正确传递;在MediaCacheService中对Windows路径进行转义处理以避免错误。
…消息处理,增强文本和多模态元素的渲染顺序;简化ThoughtStorageService中的获取最近思考记录的方法,移除过期时间参数。
2. ruff

Refactor code for consistency and readability

- Added missing commas in function calls and dictionary definitions across multiple files for better syntax consistency.
- Removed unnecessary blank lines to improve code readability in various modules.
- Consolidated multi-line statements into single lines where appropriate to enhance clarity.
- Updated error logging messages to maintain a consistent format.
- Improved the structure of conditional statements for better readability in the DefaultMessageProcessor class.
…dler integration

- Added ActionHandler dependency to QQWindowRenderer and AICOSStateGenerator for improved action handling.
- Implemented user info fetching and updating logic in QQWindowRenderer to enhance message processing.
- Updated AICOSStateGenerator to utilize ActionHandler for rendering actions.
- Enhanced ActionHandler to support better event handling and action result processing.
- Introduced new methods for group member synchronization and presence updates in EntityGraphService.
- Added last-full-sync-timestamp attribute to conversation schema for tracking synchronization status.
- Improved error handling and logging throughout the services for better traceability.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @smartmita, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a fundamental re-architecture of the AI system, shifting from a monolithic core logic to a modular, layered design. The primary goal is to establish a clear separation between the AI's operating system (AIC-OS) responsibilities, which handle external interactions and UI management, and its internal cognitive processes (Mind). This refactoring improves maintainability, scalability, and the clarity of the system's various components. Key changes include a complete migration to TypeDB for data persistence, the introduction of a new top-level cognitive loop, and the development of specialized services for managing applications, windows, file systems, and advanced cognitive functions like deliberation and narrative understanding.

Highlights

  • Architectural Overhaul: Transition from a 'Focus Chat Mode' and 'Core Logic' architecture to a layered 'AIC-OS' and 'Mind' system, clearly separating OS-level concerns from cognitive processes.
  • TypeDB Migration: The database backend has been migrated from ArangoDB to TypeDB, requiring significant changes across all data storage services.
  • New Cognitive Cycle: Introduction of a CognitiveCycle as the top-level orchestrator for the 'Perceive-Think-Act' loop, providing a structured approach to AI's continuous operation.
  • Modular OS Services: New OS-level services like ApplicationManager, WindowManager, FileSystemService, and AICOSStateGenerator are introduced for managing UI, applications, and system state.
  • Enhanced Mind Capabilities: New Mind-level services such as InformationRetrievalService, DeliberationService, GoalManager, and NarrativeVectorizer are added to enhance AI's cognitive abilities, including web search, URL summarization, deep deliberation, goal management, and multi-modal event vectorization.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Old code now departs,New layers rise, a fresh start,Pythia's mind awakes.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

你好,这次的 Pull Request 包含了一次非常大规模且意义深远的重构。从 ArangoDB 到 TypeDB 的数据库迁移,以及引入全新的 Mind/OS/Services 架构,都展示了项目在结构上的巨大进步。新的认知循环(Cognitive Cycle)、应用管理器(ApplicationManager)和叙事向量化器(NarrativeVectorizer)等组件的引入,使得整个系统的责任划分更加清晰,为未来的功能扩展和维护打下了坚实的基础。这次重构无疑是一项艰巨但非常有价值的工作,做得非常出色!

我在代码中发现了一些可以进一步改进的地方,主要涉及一个潜在的 bug 和一些设计上的优化点,希望能对你有所帮助。

Comment on lines +98 to 108
action_handler = ActionHandler(
filesystem_service=filesystem_service,
info_retrieval_service=info_retrieval_service,
thought_storage_service=db_services["thought_storage_service"],
event_storage_service=db_services["event_storage_service"],
action_log_service=db_services["action_log_service"],
action_sender=action_sender,
entity_service=db_services["entity_graph_service"],
# 注入 qq_sticker_service
qq_sticker_service=qq_sticker_service,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

ActionHandler 的初始化过程中,直接注入了平台专属的 qq_sticker_service。这可能会破坏 ActionHandler 作为平台无关的核心组件的设计原则。如果未来需要支持其他平台的表情包功能,就需要修改 ActionHandler 的构造函数。

更优雅的设计可能是,让 ActionHandler 通过 ApplicationManager 将表情包相关的动作(如 manage_stickers)分发给对应的应用构建器(QQBuilder),并由构建器内部调用其专属的 QQStickerService 来处理。这样可以保持核心组件的通用性,并将平台相关的逻辑内聚在各自的应用模块中。在 prompt_builder 中也存在类似的设计问题(141行)。

@smartmita smartmita merged commit bf9a9d4 into dev Sep 13, 2025
1 of 2 checks passed
@smartmita smartmita deleted the pythia branch September 13, 2025 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants