Loading editor/html/index.html +4 −0 Changes for editor/html/index.html: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -436,6 +436,10 @@ <label data-i18n="I18N_AI_MAX_TOKENS">Max Tokens</label> <input type="number" id="settings-ai-max-tokens" value="16384" min="1" max="131072"> </div> <div class="set-field"> <label data-i18n="I18N_AI_MAX_TOOL_ROUNDS">Max Werkzeug-Runden</label> <input type="number" id="settings-ai-max-tool-rounds" value="20" min="1" max="100"> </div> <div class="set-field"> <label data-i18n="I18N_AI_API_KEY">API Key</label> <input type="password" id="settings-ai-apikey" placeholder=""> Loading editor/html/js/editor.js +3 −1 Changes for editor/html/js/editor.js: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -1266,6 +1266,7 @@ document.getElementById('settings-ai-url').value = resp.url || ''; document.getElementById('settings-ai-model').value = resp.model || ''; document.getElementById('settings-ai-max-tokens').value = resp.max_tokens || 16384; document.getElementById('settings-ai-max-tool-rounds').value = resp.max_tool_rounds || 20; document.getElementById('settings-ai-apikey').value = resp.api_key || ''; document.getElementById('settings-ai-status').textContent = ''; }); Loading Loading @@ -1433,8 +1434,9 @@ var url = document.getElementById('settings-ai-url').value; var model = document.getElementById('settings-ai-model').value; var maxTokens = parseInt(document.getElementById('settings-ai-max-tokens').value) || 16384; var maxToolRounds = parseInt(document.getElementById('settings-ai-max-tool-rounds').value) || 20; var apiKey = document.getElementById('settings-ai-apikey').value; EditorApi.setAiSettings(url, model, maxTokens, apiKey).then(function() { EditorApi.setAiSettings(url, model, maxTokens, maxToolRounds, apiKey).then(function() { status.textContent = I18n.t('I18N_SAVED', 'Saved'); status.className = 'set-status success'; setTimeout(function() { status.textContent = ''; status.className = 'set-status'; }, 2000); Loading editor/src/webedit_api.cpp +5 −1 Changes for editor/src/webedit_api.cpp: 5 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -3297,13 +3297,15 @@ void webedit::Api::handleAiSettings(libhttppp::HttpRequest &curreq) { std::string body = getRequestBody(curreq); json_object *req = json_tokener_parse(body.c_str()); if (req) { json_object *jUrl = nullptr, *jModel = nullptr, *jMaxTokens = nullptr, *jApiKey = nullptr; json_object *jUrl = nullptr, *jModel = nullptr, *jMaxTokens = nullptr, *jMaxRounds = nullptr, *jApiKey = nullptr; if (json_object_object_get_ex(req, "url", &jUrl)) _db.setOption("AI_URL", json_object_get_string(jUrl)); if (json_object_object_get_ex(req, "model", &jModel)) _db.setOption("AI_MODEL", json_object_get_string(jModel)); if (json_object_object_get_ex(req, "max_tokens", &jMaxTokens)) _db.setOption("AI_MAX_TOKENS", std::to_string(json_object_get_int(jMaxTokens))); if (json_object_object_get_ex(req, "max_tool_rounds", &jMaxRounds)) _db.setOption("AI_MAX_TOOL_ROUNDS", std::to_string(json_object_get_int(jMaxRounds))); if (json_object_object_get_ex(req, "api_key", &jApiKey)) _db.setOption("AI_API_KEY", json_object_get_string(jApiKey)); json_object_put(req); Loading @@ -3317,6 +3319,8 @@ void webedit::Api::handleAiSettings(libhttppp::HttpRequest &curreq) { json_object_new_string(_db.getOption("AI_MODEL", "").c_str())); json_object_object_add(resp, "max_tokens", json_object_new_int(std::stoi(_db.getOption("AI_MAX_TOKENS", "16384")))); json_object_object_add(resp, "max_tool_rounds", json_object_new_int(std::stoi(_db.getOption("AI_MAX_TOOL_ROUNDS", "20")))); json_object_object_add(resp, "api_key", json_object_new_string(_db.getOption("AI_API_KEY", "").c_str())); sendJson(curreq, resp); Loading Loading
editor/html/index.html +4 −0 Changes for editor/html/index.html: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -436,6 +436,10 @@ <label data-i18n="I18N_AI_MAX_TOKENS">Max Tokens</label> <input type="number" id="settings-ai-max-tokens" value="16384" min="1" max="131072"> </div> <div class="set-field"> <label data-i18n="I18N_AI_MAX_TOOL_ROUNDS">Max Werkzeug-Runden</label> <input type="number" id="settings-ai-max-tool-rounds" value="20" min="1" max="100"> </div> <div class="set-field"> <label data-i18n="I18N_AI_API_KEY">API Key</label> <input type="password" id="settings-ai-apikey" placeholder=""> Loading
editor/html/js/editor.js +3 −1 Changes for editor/html/js/editor.js: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -1266,6 +1266,7 @@ document.getElementById('settings-ai-url').value = resp.url || ''; document.getElementById('settings-ai-model').value = resp.model || ''; document.getElementById('settings-ai-max-tokens').value = resp.max_tokens || 16384; document.getElementById('settings-ai-max-tool-rounds').value = resp.max_tool_rounds || 20; document.getElementById('settings-ai-apikey').value = resp.api_key || ''; document.getElementById('settings-ai-status').textContent = ''; }); Loading Loading @@ -1433,8 +1434,9 @@ var url = document.getElementById('settings-ai-url').value; var model = document.getElementById('settings-ai-model').value; var maxTokens = parseInt(document.getElementById('settings-ai-max-tokens').value) || 16384; var maxToolRounds = parseInt(document.getElementById('settings-ai-max-tool-rounds').value) || 20; var apiKey = document.getElementById('settings-ai-apikey').value; EditorApi.setAiSettings(url, model, maxTokens, apiKey).then(function() { EditorApi.setAiSettings(url, model, maxTokens, maxToolRounds, apiKey).then(function() { status.textContent = I18n.t('I18N_SAVED', 'Saved'); status.className = 'set-status success'; setTimeout(function() { status.textContent = ''; status.className = 'set-status'; }, 2000); Loading
editor/src/webedit_api.cpp +5 −1 Changes for editor/src/webedit_api.cpp: 5 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -3297,13 +3297,15 @@ void webedit::Api::handleAiSettings(libhttppp::HttpRequest &curreq) { std::string body = getRequestBody(curreq); json_object *req = json_tokener_parse(body.c_str()); if (req) { json_object *jUrl = nullptr, *jModel = nullptr, *jMaxTokens = nullptr, *jApiKey = nullptr; json_object *jUrl = nullptr, *jModel = nullptr, *jMaxTokens = nullptr, *jMaxRounds = nullptr, *jApiKey = nullptr; if (json_object_object_get_ex(req, "url", &jUrl)) _db.setOption("AI_URL", json_object_get_string(jUrl)); if (json_object_object_get_ex(req, "model", &jModel)) _db.setOption("AI_MODEL", json_object_get_string(jModel)); if (json_object_object_get_ex(req, "max_tokens", &jMaxTokens)) _db.setOption("AI_MAX_TOKENS", std::to_string(json_object_get_int(jMaxTokens))); if (json_object_object_get_ex(req, "max_tool_rounds", &jMaxRounds)) _db.setOption("AI_MAX_TOOL_ROUNDS", std::to_string(json_object_get_int(jMaxRounds))); if (json_object_object_get_ex(req, "api_key", &jApiKey)) _db.setOption("AI_API_KEY", json_object_get_string(jApiKey)); json_object_put(req); Loading @@ -3317,6 +3319,8 @@ void webedit::Api::handleAiSettings(libhttppp::HttpRequest &curreq) { json_object_new_string(_db.getOption("AI_MODEL", "").c_str())); json_object_object_add(resp, "max_tokens", json_object_new_int(std::stoi(_db.getOption("AI_MAX_TOKENS", "16384")))); json_object_object_add(resp, "max_tool_rounds", json_object_new_int(std::stoi(_db.getOption("AI_MAX_TOOL_ROUNDS", "20")))); json_object_object_add(resp, "api_key", json_object_new_string(_db.getOption("AI_API_KEY", "").c_str())); sendJson(curreq, resp); Loading