# palm1r/qodeassist architecture

> Architecture diagram of the GitHub repository palm1r/qodeassist, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/palm1r/qodeassist
- Repository: https://github.com/palm1r/qodeassist

## Overview

##### Main Components Identification

The system should be divided into these major components:

a) Core Plugin Interface
- QodeAssistClient (main plugin interface)
- ConfigurationManager (settings handling)
- CodeHandler (code processing)

b) LLM Integration Layer
- LLMClientInterface
- RequestHandler
- ProvidersManager
- Multiple Provider Implementations (Ollama, Claude, OpenAI, etc.)

c) Chat System
- ChatView Module
- Chat Output Panes
- Navigation Panel

d) Settings Management
- Multiple Settings Modules
- Settings Dialog
- Project Settings

e) Template System
- PromptTemplateManager
- Various Template Implementations

##### Component Relationships

**[Qt Creator IDE] <-> [QodeAssist Plugin]**

- > [Core Plugin Interface]
- > [Code Handler]
- > [Configuration Manager]

- > [LLM Integration Layer]
- > [Provider Manager]
- > [Request Handler]
- > [Provider Implementations]

- > [Chat System]
- > [Chat View]
- > [Chat Output]

- > [Template System]
- > [Template Manager]
- > [Template Implementations]

##### Key Architectural Patterns to Highlight

a) Plugin Architecture:
- How QodeAssist integrates with Qt Creator
- Extension points and plugin interfaces

b) Provider Pattern:
- Demonstrate the abstract provider interface
- Multiple concrete provider implementations

c) Template Strategy:
- How different prompt templates are managed
- Template selection and application flow

##### Important Details

a) External Integrations:
- Connection to various LLM providers (Ollama, Claude, OpenAI)
- Qt Creator plugin interface

b) Data Flow:
- Code completion request flow
- Chat message flow
- Configuration data flow

c) Configuration:
- Settings management
- Template configuration
- Provider configuration

##### Implementation Notes

- The modular nature of the provider system
- The template management system
- The separation between UI and business logic
- The chat system's integration with the core functionality

## Diagram (Mermaid)

```mermaid
%%{init: {
  'theme': 'base',
  'themeVariables': {
    'primaryColor': '#2980b9',
    'primaryTextColor': '#fff',
    'primaryBorderColor': '#2573a7',
    'lineColor': '#2573a7',
    'secondaryColor': '#1abc9c',
    'tertiaryColor': '#e74c3c'
  }
}}%%

flowchart TB
    classDef core fill:#2980b9,stroke:#2573a7,color:white
    classDef llm fill:#1abc9c,stroke:#16a085,color:white
    classDef ui fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef settings fill:#e74c3c,stroke:#c0392b,color:white
    classDef template fill:#9b59b6,stroke:#8e44ad,color:white

    QtCreator["Qt Creator IDE"]:::external
    QtCreator --> QodeAssist

    subgraph QodeAssist["QodeAssist Plugin"]
        CoreInterface["Core Plugin Interface"]:::core
        LLMLayer["LLM Integration Layer"]:::llm
        ChatSystem["Chat System"]:::ui
        TemplateSystem["Template System"]:::template
        SettingsSystem["Settings Management"]:::settings
    end

    subgraph CoreComponents["Core Components"]
        QAClient["QodeAssistClient"]:::core
        ConfigMgr["Configuration Manager"]:::core
        CodeHandler["Code Handler"]:::core
    end

    subgraph LLMComponents["LLM Components"]
        LLMInterface["LLM Client Interface"]:::llm
        ReqHandler["Request Handler"]:::llm
        ProviderMgr["Providers Manager"]:::llm
        Providers["Provider Implementations"]:::llm
    end

    subgraph ChatComponents["Chat Components"]
        ChatView["Chat View Module"]:::ui
        ChatOutput["Chat Output Panes"]:::ui
        NavPanel["Navigation Panel"]:::ui
    end

    subgraph SettingsComponents["Settings Components"]
        SettingsDialog["Settings Dialog"]:::settings
        ProjectSettings["Project Settings"]:::settings
        ProviderSettings["Provider Settings"]:::settings
    end

    subgraph TemplateComponents["Template Components"]
        TemplateManager["Prompt Template Manager"]:::template
        TemplateImpl["Template Implementations"]:::template
    end

    CoreInterface --> CoreComponents
    LLMLayer --> LLMComponents
    ChatSystem --> ChatComponents
    SettingsSystem --> SettingsComponents
    TemplateSystem --> TemplateComponents

    click QAClient "https://github.com/Palm1r/QodeAssist/blob/main/QodeAssistClient.hpp"
    click ConfigMgr "https://github.com/Palm1r/QodeAssist/blob/main/ConfigurationManager.hpp"
    click CodeHandler "https://github.com/Palm1r/QodeAssist/blob/main/CodeHandler.hpp"
    click LLMInterface "https://github.com/Palm1r/QodeAssist/blob/main/LLMClientInterface.hpp"
    click ReqHandler "https://github.com/Palm1r/QodeAssist/blob/main/llmcore/RequestHandler.hpp"
    click ProviderMgr "https://github.com/Palm1r/QodeAssist/blob/main/llmcore/ProvidersManager.hpp"
    click Providers "https://github.com/Palm1r/QodeAssist/tree/main/providers/"
    click ChatView "https://github.com/Palm1r/QodeAssist/tree/main/ChatView/"
    click ChatOutput "https://github.com/Palm1r/QodeAssist/blob/main/chat/ChatOutputPane.hpp"
    click NavPanel "https://github.com/Palm1r/QodeAssist/blob/main/chat/NavigationPanel.hpp"
    click SettingsDialog "https://github.com/Palm1r/QodeAssist/blob/main/settings/SettingsDialog.hpp"
    click ProjectSettings "https://github.com/Palm1r/QodeAssist/blob/main/settings/ProjectSettings.hpp"
    click ProviderSettings "https://github.com/Palm1r/QodeAssist/blob/main/settings/ProviderSettings.hpp"
    click TemplateManager "https://github.com/Palm1r/QodeAssist/blob/main/llmcore/PromptTemplateManager.hpp"
    click TemplateImpl "https://github.com/Palm1r/QodeAssist/tree/main/templates/"

    %% Legend
    subgraph Legend
        CoreLegend["Core Components"]:::core
        LLMLegend["LLM Components"]:::llm
        UILegend["UI Components"]:::ui
        SettingsLegend["Settings Components"]:::settings
        TemplateLegend["Template Components"]:::template
        ExternalLegend["External Systems"]:::external
    end
```
