MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / start

Method start

src/plugins/chat/chat.cpp:38–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38bool ChatPlugin::start()
39{
40 auto windowService = dpfGetService(dpfservice::WindowService);
41 if (windowService) {
42 auto Chat = new ChatWidget;
43 auto ChatImpl = new AbstractWidget(Chat);
44 windowService->addWidgetRightspace(MWNA_CHAT, ChatImpl, "");
45 }
46
47 auto optionService = dpfGetService(dpfservice::OptionService);
48 if (optionService) {
49 optionService->implGenerator<OptionChatGenerator>(option::GROUP_AI, OptionChatGenerator::kitName());
50 }
51
52 Copilot::instance();
53 ChatManager::instance()->checkCondaInstalled();
54
55 connect(&dpf::Listener::instance(), &dpf::Listener::pluginsStarted, [=] {
56 QTimer::singleShot(5000, windowService, [=] {
57#ifdef SUPPORTMINIFORGE
58 if (!ChatManager::instance()->condaHasInstalled()) {
59 QStringList actions { "ai_rag_install", ChatPlugin::tr("Install") };
60 windowService->notify(0, "AI", ChatPlugin::tr("Install a Python Conda virtual environment for using the file indexing feature.\
61 Without it, there may be abnormalities in the @codebase and some AI functionalities."),
62 actions);
63 }
64#endif
65 });
66 });
67
68 using namespace std::placeholders;
69 auto aiService = dpfGetService(dpfservice::AiService);
70 aiService->generateRag = std::bind(&ChatManager::generateRag, ChatManager::instance(), _1);
71 aiService->query = std::bind(&ChatManager::query, ChatManager::instance(), _1, _2, _3);
72 aiService->chatWithAi = std::bind(&ChatManager::requestAsync, ChatManager::instance(), _1);
73
74 auto editSrv = dpfGetService(EditorService);
75 editSrv->registerDiagnosticRepairTool("AI", std::bind(&ChatManager::repairDiagnostic, ChatManager::instance(), _1));
76
77 return true;
78}
79
80dpf::Plugin::ShutdownFlag ChatPlugin::stop()
81{

Callers 7

commitsMethod · 0.45
startInlineChatMethod · 0.45
checkCondaInstalledMethod · 0.45
showIndexingWidgetMethod · 0.45
installCondaMethod · 0.45
generateRagMethod · 0.45
queryMethod · 0.45

Calls 6

kitNameFunction · 0.85
connectFunction · 0.85
checkCondaInstalledMethod · 0.80
condaHasInstalledMethod · 0.80
notifyMethod · 0.45

Tested by

no test coverage detected