mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-07-23 19:51:05 -04:00
feat: add support acp in common chat (#369)
This commit is contained in:
@@ -7,7 +7,12 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
#include <LLMQore/AcpTypes.hpp>
|
||||
|
||||
#include "ChatModel.hpp"
|
||||
#include "ConversationPorts.hpp"
|
||||
#include "acp/AgentBinding.hpp"
|
||||
#include "acp/AgentDefinition.hpp"
|
||||
#include "session/Session.hpp"
|
||||
#include "templates/IPromptProvider.hpp"
|
||||
#include <context/ContextManager.hpp>
|
||||
@@ -16,12 +21,19 @@ namespace QodeAssist::Skills {
|
||||
class SkillsManager;
|
||||
}
|
||||
|
||||
namespace QodeAssist::Acp {
|
||||
class AcpChatBackend;
|
||||
}
|
||||
|
||||
namespace QodeAssist::Mcp {
|
||||
class AgentKnowledgeServer;
|
||||
}
|
||||
|
||||
namespace QodeAssist::Chat {
|
||||
|
||||
class ChatHistoryBridge;
|
||||
class LlmChatBackend;
|
||||
|
||||
class ChatController : public QObject
|
||||
class ChatController : public QObject, public IConversationPort
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -31,15 +43,10 @@ public:
|
||||
|
||||
void setSkillsManager(Skills::SkillsManager *skillsManager);
|
||||
|
||||
void sendMessage(
|
||||
const QString &message,
|
||||
const QList<QString> &attachments = {},
|
||||
const QList<QString> &linkedFiles = {},
|
||||
bool useTools = false,
|
||||
bool useThinking = false);
|
||||
void clearMessages();
|
||||
void sendMessage(const QString &message, const QList<QString> &attachments = {});
|
||||
void cancelRequest();
|
||||
void resetToRow(int rowIndex);
|
||||
void respondToPermission(const QString &requestId, const QString &optionId);
|
||||
|
||||
Session::Session *session() const;
|
||||
Context::ContextManager *contextManager() const;
|
||||
@@ -47,7 +54,26 @@ public:
|
||||
void setChatFilePath(const QString &filePath);
|
||||
QString chatFilePath() const;
|
||||
|
||||
QString boundAgentId() const override;
|
||||
QString boundAgentName() const;
|
||||
QList<LLMQore::Acp::AvailableCommand> agentCommands() const;
|
||||
bool conversationStarted() const override;
|
||||
bool transcriptEmpty() const override;
|
||||
Acp::AgentBinding agentBinding() const override;
|
||||
|
||||
void bindAgent(const Acp::AgentDefinition &agent) override;
|
||||
void bindLlm() override;
|
||||
void clearConversation() override;
|
||||
|
||||
void resumeAgentSession(const QString &sessionId) override;
|
||||
void startFreshAgentSession() override;
|
||||
void startFreshAgentSession(const QString &handoverSummary) override;
|
||||
void releaseAgentSession() override;
|
||||
|
||||
signals:
|
||||
void sessionInfoReceived(const QString &title);
|
||||
void agentCommandsChanged();
|
||||
void agentSessionUnavailable(const QString &reason);
|
||||
void errorOccurred(const QString &error);
|
||||
void messageReceivedCompletely();
|
||||
void requestStarted(const QString &requestId);
|
||||
@@ -57,11 +83,11 @@ signals:
|
||||
private:
|
||||
QList<Session::ContentBlock> composeUserBlocks(
|
||||
const QString &message, const QList<QString> &attachments);
|
||||
std::optional<Session::TurnContext> buildTurnContext(
|
||||
const QString &message, const QList<QString> &linkedFiles) const;
|
||||
Session::TurnContext buildTurnContext(const QString &message) const;
|
||||
void recordFileEditStatus(
|
||||
const QString &editId, const QString &status, const QString &fallbackMessage);
|
||||
void registerHistoricalEdits();
|
||||
void activateBackend(Session::ChatBackend *backend);
|
||||
|
||||
bool isImageFile(const QString &filePath) const;
|
||||
QString getMediaTypeForImage(const QString &filePath) const;
|
||||
@@ -72,7 +98,10 @@ private:
|
||||
Context::ContextManager *m_contextManager = nullptr;
|
||||
Skills::SkillsManager *m_skillsManager = nullptr;
|
||||
Session::Session *m_session = nullptr;
|
||||
LlmChatBackend *m_backend = nullptr;
|
||||
LlmChatBackend *m_llmBackend = nullptr;
|
||||
Acp::AcpChatBackend *m_acpBackend = nullptr;
|
||||
Mcp::AgentKnowledgeServer *m_agentKnowledge = nullptr;
|
||||
Session::ChatBackend *m_backend = nullptr;
|
||||
QString m_chatFilePath;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user