| 1 | /* |
| 2 | * Copyright 2024 KylinSoft Co., Ltd. |
| 3 | * |
| 4 | * This program is free software: you can redistribute it and/or modify it under |
| 5 | * the terms of the GNU General Public License as published by the Free Software |
| 6 | * Foundation, either version 3 of the License, or (at your option) any later |
| 7 | * version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 12 | * details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along with |
| 15 | * this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #ifndef DIALOGUEMANAGER_H |
| 19 | #define DIALOGUEMANAGER_Hcxx . . $ `src/services/assistant/dialoguemanager/dialoguemanager.h:19:9`! |
| 20 | |
| 21 | #include <gio/gio.h> |
| 22 | #include <kylin-ai/ai-engine/embeddingengine.h> |
| 23 | #include <kylin-ai/ai-engine/imageprocessengine.h> |
| 24 | |
| 25 | #include <memory> |
| 26 | #include <string> |
| 27 | |
| 28 | #include "assistant/handlers/requesthandlermanager.h"cxx . . $ `<file>/src/services/assistant/handlers/requesthandlermanager.h`/ |
| 29 | #include "assistant/rag/ragserverproxy.h"cxx . . $ `<file>/src/services/assistant/rag/ragserverproxy.h`/ |
| 30 | #include "assistant/session.h"cxx . . $ `<file>/src/services/assistant/session.h`/ |
| 31 | #include "engineselector/engineselector.h"cxx . . $ `<file>/src/engineselector/engineselector.h`/ |
| 32 | |
| 33 | class DialogueManagercxx . . $ DialogueManager# { |
| 34 | public: |
| 35 | explicit DialogueManagercxx . . $ DialogueManager#DialogueManager(2e91ab3de62cbed7).(GDBusConnection &connection); |
| 36 | ~cxx . . $ DialogueManager#`~DialogueManager`(49f6e7a06ebc5aa8).DialogueManagercxx . . $ DialogueManager#(); |
| 37 | |
| 38 | using TextGenerationEnginecxx . . $ DialogueManager#TextGenerationEngine# = ai_enginecxx . . $ ai_engine/::gen_aicxx . . $ ai_engine/gen_ai/::nlpcxx . . $ ai_engine/gen_ai/nlp/::AbstractTextGenerationEnginecxx . . $ ai_engine/gen_ai/nlp/AbstractTextGenerationEngine#; |
| 39 | using ImageGenerationEnginecxx . . $ DialogueManager#ImageGenerationEngine# = ai_enginecxx . . $ ai_engine/::gen_aicxx . . $ ai_engine/gen_ai/::visioncxx . . $ ai_engine/gen_ai/vision/::AbstractImageGenerationEnginecxx . . $ ai_engine/gen_ai/vision/AbstractImageGenerationEngine#; |
| 40 | using ImageProcessEnginecxx . . $ DialogueManager#ImageProcessEngine# = ai_enginecxx . . $ ai_engine/::core_aicxx . . $ ai_engine/core_ai/::visioncxx . . $ ai_engine/core_ai/vision/::AbstractImageProcessEnginecxx . . $ ai_engine/core_ai/vision/AbstractImageProcessEngine#; |
| 41 | |
| 42 | void addSessioncxx . . $ DialogueManager#addSession(d4f767463ce0a6b3).(int sessionId); |
| 43 | |
| 44 | void setBaseNlpEnginecxx . . $ DialogueManager#setBaseNlpEngine(f96c2a83634d59c4).(int sessionId, stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<TextGenerationEnginecxx . . $ DialogueManager#TextGenerationEngine#> baseNlpEngine, |
| 45 | EngineSelectorcxx . . $ EngineSelector# &engineSelector_, bool isDefaultMode); |
| 46 | |
| 47 | void setIntentNlpEnginecxx . . $ DialogueManager#setIntentNlpEngine(7e58a9627a768d7e).(int sessionId, stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<TextGenerationEnginecxx . . $ DialogueManager#TextGenerationEngine#> intentEngine); |
| 48 | |
| 49 | void setVisionEnginecxx . . $ DialogueManager#setVisionEngine(229cc0248106b0ed).(int sessionId, stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<ImageGenerationEnginecxx . . $ DialogueManager#ImageGenerationEngine#> visionEngine); |
| 50 | |
| 51 | void setImageProcessingEnginecxx . . $ DialogueManager#setImageProcessingEngine(36b0c4c991421944).(int sessionId, stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<ImageProcessEnginecxx . . $ DialogueManager#ImageProcessEngine#> imageProcessingEngine); |
| 52 | |
| 53 | void setEmbeddingEnginecxx . . $ DialogueManager#setEmbeddingEngine(b74d1a96506116e).(int sessionId, |
| 54 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<ai_enginecxx . . $ ai_engine/::core_aicxx . . $ ai_engine/core_ai/::embeddingcxx . . $ ai_engine/core_ai/embedding/::AbstractEmbeddingEnginecxx . . $ ai_engine/core_ai/embedding/AbstractEmbeddingEngine#> embeddingEngine); |
| 55 | |
| 56 | assistantcxx . . $ assistant/::ErrorCodecxx . . $ assistant/ErrorCode# handleRequestcxx . . $ DialogueManager#handleRequest(dce6e95f0761232f).(int sessionId, const stdcxx . . $ std/::stringcxx . . $ std/string# &userMessage); |
| 57 | void sendChatErrorcxx . . $ DialogueManager#sendChatError(73dc1c261e1d7ae2).(int sessionId, int errorCode, const stdcxx . . $ std/::stringcxx . . $ std/string# &errorMsg); |
| 58 | |
| 59 | void setChatSystemRolecxx . . $ DialogueManager#setChatSystemRole(295bfd7acffa215a).(int sessionId, int promptId, const stdcxx . . $ std/::stringcxx . . $ std/string# &promptName, stdcxx . . $ std/::stringcxx . . $ std/string# promptContent); |
| 60 | void setChatContextMessagescxx . . $ DialogueManager#setChatContextMessages(73dc1c261e1d7ae2).(int sessionId, int actorId, const stdcxx . . $ std/::stringcxx . . $ std/string# &contextMessages); |
| 61 | |
| 62 | void clearContextcxx . . $ DialogueManager#clearContext(d4f767463ce0a6b3).(int sessionId); |
| 63 | |
| 64 | void stopChatcxx . . $ DialogueManager#stopChat(d4f767463ce0a6b3).(int sessionId); |
| 65 | |
| 66 | void stopGenerateImagecxx . . $ DialogueManager#stopGenerateImage(d4f767463ce0a6b3).(int sessionId); |
| 67 | |
| 68 | void initIntentionRecognitioncxx . . $ DialogueManager#initIntentionRecognition(d4f767463ce0a6b3).(int sessionId); |
| 69 | |
| 70 | private: |
| 71 | void chatSystemRoleReplacecxx . . $ DialogueManager#chatSystemRoleReplace(72c2bf484d6a00aa).(int sessionId, int promptId, stdcxx . . $ std/::stringcxx . . $ std/string# &promptContent); |
| 72 | |
| 73 | void callImageProcessResultCallbackcxx . . $ DialogueManager#callImageProcessResultCallback(3b6022345fd7593a).(int sessionId, const ai_enginecxx . . $ ai_engine/::core_aicxx . . $ ai_engine/core_ai/::visioncxx . . $ ai_engine/core_ai/vision/::ImageResultcxx . . $ ai_engine/core_ai/vision/ImageResult# &imageData); |
| 74 | |
| 75 | private: |
| 76 | GDBusConnection &connection_cxx . . $ DialogueManager#connection_.; |
| 77 | stdcxx . . $ std/::mapcxx . . $ std/map#<int, assistantcxx . . $ assistant/::sessioncxx . . $ assistant/session/::DialogueSessioncxx . . $ assistant/session/DialogueSession#> sessions_cxx . . $ DialogueManager#sessions_.; |
| 78 | stdcxx . . $ std/::mapcxx . . $ std/map#<int, RequestHandlerManagercxx . . $ RequestHandlerManager#> requestHandlerManagers_cxx . . $ DialogueManager#requestHandlerManagers_.; |
| 79 | }; |
| 80 | |
| 81 | #endif |