Change API naming to KI

It is just the catchy thing to do.
This commit is contained in:
Χγφτ Kompanion 2025-10-18 14:16:16 +02:00
parent ee37ed47bb
commit dadb0af954
30 changed files with 95 additions and 94 deletions

View File

@ -2,5 +2,5 @@ add_subdirectory(cli)
add_subdirectory(dal) add_subdirectory(dal)
add_subdirectory(gui) add_subdirectory(gui)
add_subdirectory(KompanionAI) add_subdirectory(KI)
add_subdirectory(mcp) add_subdirectory(mcp)

View File

@ -1,11 +1,10 @@
set(KOM_KI_SRCS
set(KOMPANION_AI_SRCS
Client/KIClient.cpp Client/KIClient.cpp
Provider/OllamaProvider.cpp Provider/OllamaProvider.cpp
Completion/KIReply.cpp Completion/KIReply.cpp
) )
set(KOMPANION_AI_HDRS set(KOM_KI_HDRS
Client/KIClient.h Client/KIClient.h
Provider/KIProvider.h Provider/KIProvider.h
Provider/KICapabilities.h Provider/KICapabilities.h
@ -20,14 +19,14 @@ set(KOMPANION_AI_HDRS
Policy/KIPolicy.h Policy/KIPolicy.h
) )
add_library(kom_ai STATIC ${KOMPANION_AI_SRCS} ${KOMPANION_AI_HDRS}) add_library(kom_ki STATIC ${KOM_KI_SRCS} ${KOM_KI_HDRS})
target_include_directories(kom_ai PUBLIC target_include_directories(kom_ki PUBLIC
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${Qt6Core_INCLUDE_DIRS} ${Qt6Core_INCLUDE_DIRS}
) )
target_link_libraries(kom_ai PUBLIC target_link_libraries(kom_ki PUBLIC
Qt6::Core Qt6::Core
Qt6::Network Qt6::Network
) )

View File

@ -1,7 +1,7 @@
#include "KIClient.h" #include "KIClient.h"
namespace KompanionAI { namespace KI {
KIClient::KIClient(QObject *parent) : QObject(parent) KIClient::KIClient(QObject *parent) : QObject(parent)
{ {
@ -58,4 +58,4 @@ void KIClient::cancel(quint64 requestId)
} }
} }
} // namespace KompanionAI } // namespace KI

View File

@ -9,7 +9,7 @@
#include "../Completion/KIChatOptions.h" #include "../Completion/KIChatOptions.h"
#include "../Embedding/KIEmbedding.h" #include "../Embedding/KIEmbedding.h"
namespace KompanionAI { namespace KI {
class KIClient : public QObject class KIClient : public QObject
{ {
@ -39,6 +39,6 @@ private:
QString m_defaultModel; QString m_defaultModel;
}; };
} // namespace KompanionAI } // namespace KI
#endif // KIANICLIENT_H #endif // KIANICLIENT_H

View File

@ -7,7 +7,7 @@
#include "../Tool/KITool.h" #include "../Tool/KITool.h"
#include "../Policy/KIPolicy.h" #include "../Policy/KIPolicy.h"
namespace KompanionAI { namespace KI {
class KIChatOptions class KIChatOptions
{ {
@ -33,6 +33,6 @@ public:
bool operator!=(const KIChatOptions& other) const = default; bool operator!=(const KIChatOptions& other) const = default;
}; };
} // namespace KompanionAI } // namespace KI
#endif // KIANICHATOPTIONS_H #endif // KIANICHATOPTIONS_H

View File

@ -4,7 +4,7 @@
#include <QObject> #include <QObject>
#include <QString> #include <QString>
namespace KompanionAI { namespace KI {
class KIError class KIError
{ {
@ -33,6 +33,6 @@ public:
bool operator!=(const KIError& other) const = default; bool operator!=(const KIError& other) const = default;
}; };
} // namespace KompanionAI } // namespace KI
#endif // KIANIERROR_H #endif // KIANIERROR_H

View File

@ -2,7 +2,7 @@
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
namespace KompanionAI { namespace KI {
QString KIReply::text() const QString KIReply::text() const
{ {
@ -48,4 +48,4 @@ void KIReply::processIncomingData(const QByteArray& newData)
} }
} }
} // namespace KompanionAI } // namespace KI

View File

@ -8,7 +8,7 @@
#include "../Tool/KITool.h" #include "../Tool/KITool.h"
#include "KIError.h" #include "KIError.h"
namespace KompanionAI { namespace KI {
class KIReply : public QObject class KIReply : public QObject
{ {
@ -52,6 +52,6 @@ protected:
QString m_accumulatedText; // Added for accumulating text QString m_accumulatedText; // Added for accumulating text
}; };
} // namespace KompanionAI } // namespace KI
#endif // KIANIREPLY_H #endif // KIANIREPLY_H

View File

@ -6,7 +6,7 @@
#include <QString> #include <QString>
#include <QVector> #include <QVector>
namespace KompanionAI { namespace KI {
class KIEmbedOptions class KIEmbedOptions
{ {
@ -34,6 +34,6 @@ public:
bool operator!=(const KIEmbeddingResult& other) const = default; bool operator!=(const KIEmbeddingResult& other) const = default;
}; };
} // namespace KompanionAI } // namespace KI
#endif // KIANIEMBEDDING_H #endif // KIANIEMBEDDING_H

View File

@ -7,7 +7,7 @@
#include <QList> #include <QList>
#include <QVariantMap> #include <QVariantMap>
namespace KompanionAI { namespace KI {
class KIMessagePart class KIMessagePart
{ {
@ -37,6 +37,6 @@ class KIMessage
bool operator!=(const KIMessage& other) const = default; bool operator!=(const KIMessage& other) const = default;
}; };
} // namespace KompanionAI } // namespace KI
#endif // KIANIMESSAGE_H #endif // KIANIMESSAGE_H

View File

@ -6,7 +6,7 @@
#include <QList> #include <QList>
#include "KIMessage.h" #include "KIMessage.h"
namespace KompanionAI { namespace KI {
class KIThread class KIThread
{ {
@ -20,6 +20,6 @@ public:
bool operator!=(const KIThread& other) const = default; bool operator!=(const KIThread& other) const = default;
}; };
} // namespace KompanionAI } // namespace KI
#endif // KIANITHREAD_H #endif // KIANITHREAD_H

View File

@ -5,7 +5,7 @@
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
namespace KompanionAI { namespace KI {
class KIPolicy class KIPolicy
{ {
@ -23,6 +23,6 @@ public:
bool operator!=(const KIPolicy& other) const = default; bool operator!=(const KIPolicy& other) const = default;
}; };
} // namespace KompanionAI } // namespace KI
#endif // KIANIPOLICY_H #endif // KIANIPOLICY_H

View File

@ -3,7 +3,7 @@
#include <QObject> #include <QObject>
namespace KompanionAI { namespace KI {
class KICapabilities : public QObject class KICapabilities : public QObject
{ {
@ -37,6 +37,6 @@ private:
bool m_images = false; bool m_images = false;
}; };
} // namespace KompanionAI } // namespace KI
#endif // KIANICAPABILITIES_H #endif // KIANICAPABILITIES_H

View File

@ -9,7 +9,7 @@
#include "../Embedding/KIEmbedding.h" #include "../Embedding/KIEmbedding.h"
#include "KICapabilities.h" #include "KICapabilities.h"
namespace KompanionAI { namespace KI {
class KIChatOptions; // Forward declaration class KIChatOptions; // Forward declaration
class KIEmbedOptions; // Forward declaration class KIEmbedOptions; // Forward declaration
@ -36,6 +36,6 @@ signals:
void modelsChanged(); void modelsChanged();
}; };
} // namespace KompanionAI } // namespace KI
#endif // KIANIPROVIDER_H #endif // KIANIPROVIDER_H

View File

@ -6,7 +6,7 @@
#include "../Completion/KIChatOptions.h" // Added #include "../Completion/KIChatOptions.h" // Added
#include "../Completion/KIError.h" // Added #include "../Completion/KIError.h" // Added
namespace KompanionAI { namespace KI {
OllamaProvider::OllamaProvider(QObject *parent) : KIProvider(parent) OllamaProvider::OllamaProvider(QObject *parent) : KIProvider(parent)
{ {
@ -153,4 +153,4 @@ void OllamaProvider::cancel(quint64 requestId)
// TODO: Implement cancellation logic // TODO: Implement cancellation logic
} }
} // namespace KompanionAI } // namespace KI

View File

@ -10,7 +10,7 @@
#include "../Message/KIThread.h" // Included full definition for KIThread #include "../Message/KIThread.h" // Included full definition for KIThread
#include "KICapabilities.h" #include "KICapabilities.h"
namespace KompanionAI { namespace KI {
class OllamaProvider : public KIProvider class OllamaProvider : public KIProvider
{ {
@ -36,6 +36,6 @@ private:
KICapabilities* m_caps; KICapabilities* m_caps;
}; };
} // namespace KompanionAI } // namespace KI
#endif // OLLAMAPROVIDER_H #endif // OLLAMAPROVIDER_H

View File

@ -8,7 +8,7 @@
#include <QVariant> #include <QVariant>
#include <QVariantMap> #include <QVariantMap>
namespace KompanionAI { namespace KI {
class KIToolParam class KIToolParam
{ {
@ -70,6 +70,6 @@ public:
bool operator!=(const KIToolResult& other) const = default; bool operator!=(const KIToolResult& other) const = default;
}; };
} // namespace KompanionAI } // namespace KI
#endif // KIANITOOL_H #endif // KIANITOOL_H

View File

@ -7,6 +7,6 @@ Qt6::Core
Qt6::Sql Qt6::Sql
KF6::ConfigCore KF6::ConfigCore
kom_dal kom_dal
kom_ai kom_ki
) )
install(TARGETS kompanion RUNTIME ${KF_INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS kompanion RUNTIME ${KF_INSTALL_TARGETS_DEFAULT_ARGS})

View File

@ -5,7 +5,7 @@
#include <utility> #include <utility>
#include <optional> #include <optional>
namespace kom { namespace ki {
class IDatabase { class IDatabase {
public: public:
virtual ~IDatabase() = default; virtual ~IDatabase() = default;

View File

@ -4,7 +4,7 @@
#include <optional> #include <optional>
#include <cstdint> #include <cstdint>
namespace kom { namespace ki {
struct MemoryItem { struct MemoryItem {
std::string id; std::string id;
std::string namespace_id; std::string namespace_id;

View File

@ -18,7 +18,7 @@
#include <numeric> #include <numeric>
#include <stdexcept> #include <stdexcept>
namespace kom { namespace ki {
namespace { namespace {
@ -1101,4 +1101,4 @@ std::vector<std::string> PgDal::parsePgTextArray(const QString& value) {
return tags; return tags;
} }
} // namespace kom } // namespace ki

View File

@ -14,7 +14,7 @@
#include <unordered_set> #include <unordered_set>
#include <vector> #include <vector>
namespace kom { namespace ki {
struct NamespaceRow { struct NamespaceRow {
std::string id; std::string id;
@ -177,4 +177,4 @@ private:
std::unordered_map<std::string, EmbeddingRow> embeddings_; std::unordered_map<std::string, EmbeddingRow> embeddings_;
}; };
} // namespace kom } // namespace ki

View File

@ -11,7 +11,7 @@ target_link_libraries(kompanion_gui PRIVATE
Qt6::McpServer Qt6::McpServer
Qt6::McpCommon Qt6::McpCommon
kom_dal kom_dal
kom_ai kom_ki
) )
install(TARGETS kompanion_gui RUNTIME DESTINATION bin) install(TARGETS kompanion_gui RUNTIME DESTINATION bin)

View File

@ -10,12 +10,12 @@
#include <QApplication> #include <QApplication>
#include <QFutureWatcher> #include <QFutureWatcher>
#include <KompanionAI/Client/KIClient.h> #include <Client/KIClient.h>
#include <KompanionAI/Provider/OllamaProvider.h> #include <Provider/OllamaProvider.h>
#include <KompanionAI/Message/KIMessage.h> #include <Message/KIMessage.h>
#include <KompanionAI/Message/KIThread.h> #include <Message/KIThread.h>
#include <KompanionAI/Completion/KIReply.h> #include <Completion/KIReply.h>
#include <KompanionAI/Completion/KIChatOptions.h> #include <Completion/KIChatOptions.h>
class MainWindow : public KParts::MainWindow class MainWindow : public KParts::MainWindow
@ -42,9 +42,9 @@ public:
connect(sendButton, &QPushButton::clicked, this, &MainWindow::sendMessage); connect(sendButton, &QPushButton::clicked, this, &MainWindow::sendMessage);
// Setup KompanionAI // Setup KI
m_ollamaProvider = new KompanionAI::OllamaProvider(this); m_ollamaProvider = new KI::OllamaProvider(this);
m_kompanionClient = new KompanionAI::KIClient(this); m_kompanionClient = new KI::KIClient(this);
m_kompanionClient->setProvider(m_ollamaProvider); m_kompanionClient->setProvider(m_ollamaProvider);
m_kompanionClient->setDefaultModel("llama2"); // Or some other default m_kompanionClient->setDefaultModel("llama2"); // Or some other default
} }
@ -62,29 +62,29 @@ private slots:
// Append user message to chat view // Append user message to chat view
insertText(QString("User: %1\n").arg(message)); insertText(QString("User: %1\n").arg(message));
// Send message to KompanionAI // Send message to KI
KompanionAI::KIThread thread; KI::KIThread thread;
KompanionAI::KIMessage kimessage; KI::KIMessage kimessage;
kimessage.role = "user"; kimessage.role = "user";
KompanionAI::KIMessagePart part; KI::KIMessagePart part;
part.mime = "text/plain"; part.mime = "text/plain";
part.text = message; part.text = message;
kimessage.parts.append(part); kimessage.parts.append(part);
thread.messages.append(kimessage); thread.messages.append(kimessage);
KompanionAI::KIChatOptions opts; KI::KIChatOptions opts;
opts.model = m_kompanionClient->defaultModel(); opts.model = m_kompanionClient->defaultModel();
QFuture<KompanionAI::KIReply*> future = m_kompanionClient->chat(thread, opts); QFuture<KI::KIReply*> future = m_kompanionClient->chat(thread, opts);
QFutureWatcher<KompanionAI::KIReply*> *watcher = new QFutureWatcher<KompanionAI::KIReply*>(this); QFutureWatcher<KI::KIReply*> *watcher = new QFutureWatcher<KI::KIReply*>(this);
connect(watcher, &QFutureWatcher<KompanionAI::KIReply*>::finished, this, [this, watcher]() { connect(watcher, &QFutureWatcher<KI::KIReply*>::finished, this, [this, watcher]() {
KompanionAI::KIReply* reply = watcher->result(); KI::KIReply* reply = watcher->result();
connect(reply, &KompanionAI::KIReply::tokensAdded, this, [this](const QString& delta) { connect(reply, &KI::KIReply::tokensAdded, this, [this](const QString& delta) {
insertText(delta); insertText(delta);
}); });
connect(reply, &KompanionAI::KIReply::finished, this, [this, reply]() { connect(reply, &KI::KIReply::finished, this, [this, reply]() {
insertText("\n"); insertText("\n");
reply->deleteLater(); reply->deleteLater();
}); });
@ -105,8 +105,8 @@ private:
KTextEditor::Document *m_document; KTextEditor::Document *m_document;
QLineEdit *m_chatInput; QLineEdit *m_chatInput;
KompanionAI::KIClient* m_kompanionClient; KI::KIClient* m_kompanionClient;
KompanionAI::OllamaProvider* m_ollamaProvider; KI::OllamaProvider* m_ollamaProvider;
}; };
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -117,4 +117,4 @@ int main(int argc, char *argv[])
window.show(); window.show();
return app.exec(); return app.exec();
} }

View File

@ -200,7 +200,7 @@ int main(int argc, char **argv)
std::cerr << "[kom_mcp] PG_DSN not set; DAL will fall back to stubbed mode. Configure Database/PgDsn to enable persistence.\n"; std::cerr << "[kom_mcp] PG_DSN not set; DAL will fall back to stubbed mode. Configure Database/PgDsn to enable persistence.\n";
} }
kom::PgDal dal; ki::PgDal dal;
if (effectiveDsn) { if (effectiveDsn) {
if (!dal.connect(*effectiveDsn)) { if (!dal.connect(*effectiveDsn)) {
std::cerr << "[kom_mcp] Failed to connect to database; DAL will fall back to stubbed mode.\n"; std::cerr << "[kom_mcp] Failed to connect to database; DAL will fall back to stubbed mode.\n";

View File

@ -1,3 +1,5 @@
find_package(Qt6 REQUIRED COMPONENTS Core)
add_library(kom_mcp STATIC add_library(kom_mcp STATIC
KompanionQtServer.cpp KompanionQtServer.cpp
) )
@ -10,7 +12,7 @@ qt_add_resources(kom_mcp kompanion_mcp_resources
target_link_libraries(kom_mcp PRIVATE target_link_libraries(kom_mcp PRIVATE
kom_dal kom_dal
kom_ai kom_ki
KF6::ConfigCore KF6::ConfigCore
Qt6::Core Qt6::Core
Qt6::Network Qt6::Network
@ -26,4 +28,4 @@ target_compile_definitions(kom_mcp PRIVATE
) )
install(FILES ToolSchemas.json DESTINATION ${KDE_INSTALL_DATADIR}/kompanion/mcp) install(FILES ToolSchemas.json DESTINATION ${KDE_INSTALL_DATADIR}/kompanion/mcp)

View File

@ -19,8 +19,8 @@
namespace Handlers { namespace Handlers {
namespace detail { namespace detail {
inline kom::PgDal& database() { inline ki::PgDal& database() {
static kom::PgDal instance; static ki::PgDal instance;
static bool connected = [] { static bool connected = [] {
const char* env = std::getenv("PG_DSN"); const char* env = std::getenv("PG_DSN");
const std::string dsn = (env && *env) ? std::string(env) : std::string(); const std::string dsn = (env && *env) ? std::string(env) : std::string();
@ -385,7 +385,7 @@ inline std::string upsert_memory(const std::string& reqJson) {
return detail::error_response("bad_request", "items array must contain at least one entry"); return detail::error_response("bad_request", "items array must contain at least one entry");
} }
kom::PgDal& dal = detail::database(); ki::PgDal& dal = detail::database();
const bool hasTx = dal.begin(); const bool hasTx = dal.begin();
std::vector<std::string> ids; std::vector<std::string> ids;
ids.reserve(items.size()); ids.reserve(items.size());
@ -394,7 +394,7 @@ inline std::string upsert_memory(const std::string& reqJson) {
try { try {
#endif #endif
for (auto& parsed : items) { for (auto& parsed : items) {
kom::ItemRow row; ki::ItemRow row;
row.id = parsed.id; row.id = parsed.id;
row.namespace_id = nsRow->id; row.namespace_id = nsRow->id;
row.content_json = parsed.rawJson; row.content_json = parsed.rawJson;
@ -406,18 +406,18 @@ inline std::string upsert_memory(const std::string& reqJson) {
ids.push_back(itemId); ids.push_back(itemId);
if (!parsed.embedding.empty()) { if (!parsed.embedding.empty()) {
kom::ChunkRow chunk; ki::ChunkRow chunk;
chunk.item_id = itemId; chunk.item_id = itemId;
chunk.ord = 0; chunk.ord = 0;
chunk.text = parsed.text; chunk.text = parsed.text;
auto chunkIds = dal.upsertChunks(std::vector<kom::ChunkRow>{chunk}); auto chunkIds = dal.upsertChunks(std::vector<ki::ChunkRow>{chunk});
kom::EmbeddingRow emb; ki::EmbeddingRow emb;
emb.chunk_id = chunkIds.front(); emb.chunk_id = chunkIds.front();
emb.model = "stub-model"; emb.model = "stub-model";
emb.dim = static_cast<int>(parsed.embedding.size()); emb.dim = static_cast<int>(parsed.embedding.size());
emb.vector = parsed.embedding; emb.vector = parsed.embedding;
dal.upsertEmbeddings(std::vector<kom::EmbeddingRow>{emb}); dal.upsertEmbeddings(std::vector<ki::EmbeddingRow>{emb});
} }
} }
#if defined(__cpp_exceptions) #if defined(__cpp_exceptions)
@ -466,7 +466,7 @@ inline std::string search_memory(const std::string& reqJson) {
} }
} }
kom::PgDal& dal = detail::database(); ki::PgDal& dal = detail::database();
std::unordered_set<std::string> seen; std::unordered_set<std::string> seen;
std::vector<detail::SearchMatch> matches; std::vector<detail::SearchMatch> matches;
@ -520,8 +520,8 @@ inline std::string save_context(const std::string& reqJson) {
auto tags = detail::parse_string_array(reqJson, "tags"); auto tags = detail::parse_string_array(reqJson, "tags");
auto ttlOpt = detail::extract_int_field(reqJson, "ttl_seconds"); auto ttlOpt = detail::extract_int_field(reqJson, "ttl_seconds");
kom::PgDal& dal = detail::database(); ki::PgDal& dal = detail::database();
kom::ItemRow row; ki::ItemRow row;
row.namespace_id = nsRow->id; row.namespace_id = nsRow->id;
if (!key.empty()) { if (!key.empty()) {
row.key = key; row.key = key;
@ -600,7 +600,7 @@ inline std::string recall_context(const std::string& reqJson) {
sinceOpt = since; sinceOpt = since;
} }
kom::PgDal& dal = detail::database(); ki::PgDal& dal = detail::database();
auto rows = dal.fetchContext(nsRow->id, keyOpt, tags, sinceOpt, limit); auto rows = dal.fetchContext(nsRow->id, keyOpt, tags, sinceOpt, limit);
std::ostringstream os; std::ostringstream os;

View File

@ -38,7 +38,7 @@ QString normaliseToolName(const QString &defaultNamespace, const QString &rawNam
} }
} // namespace } // namespace
KompanionQtServer::KompanionQtServer(const QString &backend, KomMcpServer *logic, kom::PgDal* dal, QObject *parent) KompanionQtServer::KompanionQtServer(const QString &backend, KomMcpServer *logic, ki::PgDal* dal, QObject *parent)
: QMcpServer(backend, parent) : QMcpServer(backend, parent)
, m_logic(logic) , m_logic(logic)
, m_dal(dal) , m_dal(dal)

View File

@ -5,7 +5,7 @@
#include <QtCore/QObject> #include <QtCore/QObject>
class KomMcpServer; class KomMcpServer;
namespace kom { namespace ki {
class PgDal; class PgDal;
} }
class QMcpTool; class QMcpTool;
@ -14,12 +14,12 @@ class KompanionQtServer : public QMcpServer
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit KompanionQtServer(const QString &backend, KomMcpServer *logic, kom::PgDal* dal, QObject *parent = nullptr); explicit KompanionQtServer(const QString &backend, KomMcpServer *logic, ki::PgDal* dal, QObject *parent = nullptr);
private: private:
QList<QMcpTool> loadToolsFromSchema() const; QList<QMcpTool> loadToolsFromSchema() const;
KomMcpServer *m_logic; KomMcpServer *m_logic;
kom::PgDal* m_dal; ki::PgDal* m_dal;
QList<QMcpTool> m_tools; QList<QMcpTool> m_tools;
}; };

View File

@ -5,31 +5,31 @@
#include <vector> #include <vector>
static void contract_pgdal_basic() { static void contract_pgdal_basic() {
kom::PgDal dal; ki::PgDal dal;
dal.connect("stub://memory"); dal.connect("stub://memory");
auto ns = dal.ensureNamespace("tests"); auto ns = dal.ensureNamespace("tests");
static_cast<void>(ns); static_cast<void>(ns);
kom::ItemRow item; ki::ItemRow item;
item.namespace_id = "tests"; item.namespace_id = "tests";
item.text = std::string("example"); item.text = std::string("example");
item.tags = {"alpha", "beta"}; item.tags = {"alpha", "beta"};
item.id = dal.upsertItem(item); item.id = dal.upsertItem(item);
kom::ChunkRow chunk; ki::ChunkRow chunk;
chunk.item_id = item.id; chunk.item_id = item.id;
chunk.text = "chunk-text"; chunk.text = "chunk-text";
auto chunkIds = dal.upsertChunks(std::vector<kom::ChunkRow>{chunk}); auto chunkIds = dal.upsertChunks(std::vector<ki::ChunkRow>{chunk});
if (!chunkIds.empty()) { if (!chunkIds.empty()) {
chunk.id = chunkIds.front(); chunk.id = chunkIds.front();
} }
kom::EmbeddingRow embedding; ki::EmbeddingRow embedding;
embedding.chunk_id = chunk.id; embedding.chunk_id = chunk.id;
embedding.model = "stub-model"; embedding.model = "stub-model";
embedding.dim = 3; embedding.dim = 3;
embedding.vector = {0.1f, 0.2f, 0.3f}; embedding.vector = {0.1f, 0.2f, 0.3f};
dal.upsertEmbeddings(std::vector<kom::EmbeddingRow>{embedding}); dal.upsertEmbeddings(std::vector<ki::EmbeddingRow>{embedding});
static_cast<void>(dal.searchText("tests", "chunk", 5)); static_cast<void>(dal.searchText("tests", "chunk", 5));
static_cast<void>(dal.searchVector("tests", embedding.vector, 5)); static_cast<void>(dal.searchVector("tests", embedding.vector, 5));