How jhihjian/guyu works
Project Type and Purpose
• This is a Python-based personal assistant application aimed at aggregating personal daily data, including food intake, exercise, and other lifestyle details.
• It integrates various functionalities such as a UI interface, database connectivity (sqlite), voice recognition (及语音唤醒), QQ message listening, and connections to large-model APIs for natural language processing.
• There’s also the FoodCa functionality: a streamlined, voice-interpreting tool that records food intake and fetches nutritional information via an AI-based back end.
File Structure for Architectural Clues
• The top-level “pydev” directory contains the core source code.
• “pydev/src/QianFanApi.py” likely encapsulates API interactions (possibly with the large model or nutrition API).
• “pydev/src/util” includes helper modules such as DESHelper.py and PWManager.py, suggesting responsibilities for encryption and password/credential management.
• The “pydev/requirements.txt” file points to external dependencies.
• The “resource” directory holds files like “pw.txt” and “qianfan_key_id_data” which are probably used for authentication and secure storage of API keys or other sensitive configuration.
• Although there isn’t an explicit “UI” directory, the README mentions a UI. This indicates that the UI might be integrated within the main code or built using packaged resources.
Key Components
a. User Interface (UI) Layer:
• Represents the desktop UI for the exe version of “谷雨”. This would handle voice commands and daily logs.
• This as a distinct module even if internals are embedded.
b. API Integration Module:
• QianFanApi.py should be shown as the module that handles communication with external large models and APIs to perform tasks like nutritional analysis and natural language processing.
c. Utility Modules:
• DESHelper and PWManager as submodules under a “Security / Credential Manager” component for encryption and managing keys/resources.
d. Resource / Configuration Component:
• The “resource” folder (with pw.txt and qianfan_key_id_data) serves as a configuration backing store.
e. Database Component:
• As per the README mention, an embedded sqlite database should be depicted to show persistent data storage used for daily logs, food recording, or event logs.
f. Specialized Modules:
g. FoodCa Functionality:
• Since FoodCa is positioned as a streamlined record tool for nutritional info, indicate a dedicated “Food Analysis” or “Calorie Recorder” component. Show its relationship to the API integration layer (for nutrition models) as well as its connection to charting/dashboard outputs for historical data.
Relationships and Interactions
• From the User Interface to the API module (representing user commands triggering requests to the large model).
• From the API module to external services (nutritional databases, language model endpoints), which may be represented as a cloud or external system.
• From utility/security components to both configuration/resource storage and API integration (to handle secure key usage).
• Between UI and Database, illustrating data persistence such as voice logs and daily records.
• The FoodCa recording module should have inputs from the UI (voice or text input describing food) and outputs connecting to the API (for analysis) and then back to UI/database display.
Architectural Patterns and Design Principles
• A modular design with clear separation of concerns:
• UI separated from the core business logic and API interactions.
• Security utilities decoupled from the core API integration, facilitating secure key management.
• Use of an embedded database for localized storage.
• Layers (Presentation, Business Logic/API, Data Storage, and Security/Configuration).