Refactor Architecture to Split Agent, LLM, and UI Layers#10
Conversation
- Created `src/llm/` directory with `LLMProvider` abstract base class. - Implemented `OpenAIProvider` to wrap OpenAI functionality and provide a standardized `OpenAILikeResponse` that supports streaming and tool calls. - Created `factory.py` to instantiate the appropriate provider based on config. - Refactored `src/agent/brain.py` to use the new LLM factory instead of tightly coupling to OpenAI. - Implemented the tool-use ReAct loop (`while stop_reason == 'tool_use'`) based on the `learn-claude-code` tutorial for the core agent loop. - Updated `SettingsDialog` in `src/main_window.py` to allow selecting the LLM Provider Type (`api_type` dropdown). - Updated DB interactions inside `src/memory_service.py` to cleanly use the LLM layer for summaries. - Fixed and updated unit tests (`test_agent.py`) to mock the new provider factory. Co-authored-by: JackLeeHal <15664755+JackLeeHal@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
The user asked to refactor the application into three layers: Agent, LLM Provider (Backend), and UI. The Agent layer was modified to mirror the
learn-claude-codecore loop logic. The Backend was refactored to support multiple LLM providers (currently OpenAI with placeholder for Anthropic), configured via the settings UI.The implementation successfully abstracts the LLM out of the agent loop, standardizes the response with
OpenAILikeResponse, and provides a seamless UI dropdown to switch providers without altering the agent's core tool-use logic.PR created automatically by Jules for task 3849718813426237228 started by @JackLeeHal