MCPcopy Create free account
hub / github.com/Palm1r/QodeAssist / saveToFile

Method saveToFile

ChatView/ChatSerializer.cpp:20–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18const QString ChatSerializer::VERSION = "0.2";
19
20SerializationResult ChatSerializer::saveToFile(const ChatModel *model, const QString &filePath)
21{
22 if (!ensureDirectoryExists(filePath)) {
23 return {false, "Failed to create directory structure"};
24 }
25
26 QFile file(filePath);
27 if (!file.open(QIODevice::WriteOnly)) {
28 return {false, QString("Failed to open file for writing: %1").arg(filePath)};
29 }
30
31 QJsonObject root = serializeChat(model, filePath);
32 QJsonDocument doc(root);
33
34 if (file.write(doc.toJson(QJsonDocument::Indented)) == -1) {
35 return {false, QString("Failed to write to file: %1").arg(file.errorString())};
36 }
37
38 return {true, QString()};
39}
40
41SerializationResult ChatSerializer::loadFromFile(ChatModel *model, const QString &filePath)
42{

Callers

nothing calls this directly

Calls 1

toJsonMethod · 0.45

Tested by

no test coverage detected