| 72 | } // namespace |
| 73 | |
| 74 | ChatRootView::ChatRootView(QQuickItem *parent) |
| 75 | : QQuickItem(parent) |
| 76 | , m_chatModel(new ChatModel(this)) |
| 77 | , m_promptProvider(PluginLLMCore::PromptTemplateManager::instance()) |
| 78 | , m_clientInterface(new ClientInterface(m_chatModel, &m_promptProvider, this)) |
| 79 | , m_fileManager(new ChatFileManager(this)) |
| 80 | , m_isRequestInProgress(false) |
| 81 | , m_chatCompressor(new ChatCompressor(this)) |
| 82 | , m_agentRoleController(new AgentRoleController(this)) |
| 83 | , m_configurationController(new ChatConfigurationController(this)) |
| 84 | , m_fileEditController(new FileEditController(m_chatModel, this)) |
| 85 | , m_tokenCounter( |
| 86 | new InputTokenCounter(m_chatModel, m_clientInterface->contextManager(), this)) |
| 87 | , m_historyStore(new ChatHistoryStore(m_chatModel, this)) |
| 88 | { |
| 89 | m_isSyncOpenFiles = Settings::chatAssistantSettings().linkOpenFiles(); |
| 90 | connect( |
| 91 | &Settings::chatAssistantSettings().linkOpenFiles, |
| 92 | &Utils::BaseAspect::changed, |
| 93 | this, |
| 94 | [this]() { setIsSyncOpenFiles(Settings::chatAssistantSettings().linkOpenFiles()); }); |
| 95 | |
| 96 | QMetaObject::invokeMethod( |
| 97 | this, |
| 98 | [this] { |
| 99 | if (auto sendCommand |
| 100 | = Core::ActionManager::command(Constants::QODE_ASSIST_CHAT_SEND_MESSAGE)) { |
| 101 | connect( |
| 102 | sendCommand, |
| 103 | &Core::Command::keySequenceChanged, |
| 104 | this, |
| 105 | &ChatRootView::sendShortcutTextChanged, |
| 106 | Qt::UniqueConnection); |
| 107 | } |
| 108 | emit sendShortcutTextChanged(); |
| 109 | }, |
| 110 | Qt::QueuedConnection); |
| 111 | |
| 112 | auto &settings = Settings::generalSettings(); |
| 113 | |
| 114 | connect( |
| 115 | &settings.caModel, &Utils::BaseAspect::changed, this, &ChatRootView::currentTemplateChanged); |
| 116 | |
| 117 | connect( |
| 118 | m_configurationController, |
| 119 | &ChatConfigurationController::availableConfigurationsChanged, |
| 120 | this, |
| 121 | &ChatRootView::availableConfigurationsChanged); |
| 122 | connect( |
| 123 | m_configurationController, |
| 124 | &ChatConfigurationController::currentConfigurationChanged, |
| 125 | this, |
| 126 | &ChatRootView::currentConfigurationChanged); |
| 127 | |
| 128 | connect( |
| 129 | m_clientInterface, |
| 130 | &ClientInterface::messageReceivedCompletely, |
| 131 | this, |
nothing calls this directly
no test coverage detected