KTextAddons

openaiclient.cpp
1/*
2 SPDX-FileCopyrightText: 2025 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "openaiclient.h"
8#include "openaiconfiguredialog.h"
9#include "openaiplugin.h"
10#include <KLocalizedString>
11
12using namespace Qt::Literals::StringLiterals;
13OpenAIClient::OpenAIClient(QObject *parent)
14 : TextAutogenerateText::TextAutogenerateTextClient{parent}
15{
16}
17
18OpenAIClient::~OpenAIClient() = default;
19
20QString OpenAIClient::name() const
21{
22 return "openai"_L1;
23}
24
25QString OpenAIClient::translatedName() const
26{
27 return i18n("OpenAI");
28}
29
30TextAutogenerateText::TextAutogenerateTextPlugin *OpenAIClient::createTextAutogeneratePlugin()
31{
32 return new OpenAIPlugin(this);
33}
34
35TextAutogenerateText::TextAutogenerateTextClient::EngineType OpenAIClient::engineType() const
36{
37 return TextAutogenerateText::TextAutogenerateTextClient::EngineType::Network;
38}
39
40bool OpenAIClient::hasConfigurationDialog() const
41{
42 return true;
43}
44
45bool OpenAIClient::showConfigureDialog(QWidget *parentWidget)
46{
47 // TODO use QPointer here ???
48 OpenAIConfigureDialog d(parentWidget);
49 return d.exec();
50}
51
52QString OpenAIClient::webSite() const
53{
54 return QStringLiteral("https://openai.com/");
55}
56
57QString OpenAIClient::modelName() const
58{
59 // No model here
60 return {};
61}
62
63#include "moc_openaiclient.cpp"
QString i18n(const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri May 2 2025 12:06:03 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.