summaryrefslogtreecommitdiff
path: root/htroot
diff options
context:
space:
mode:
authorMichael Peter Christen <mc@yacy.net>2026-03-29 00:20:49 +0100
committerMichael Peter Christen <mc@yacy.net>2026-03-29 00:20:49 +0100
commit5d5e8e889a0f53ac437caa2cfd4729b9a18be2ea (patch)
tree6787419b497a1c8ca5b9cf3c5840db01091892ae /htroot
parentc79b7a19c8d6e9679219bc5f64bd34daa2ae2574 (diff)
Restore tool-enabled chat requests from persisted model capabilities
Diffstat (limited to 'htroot')
-rw-r--r--htroot/LLMSelection_p.html10
-rw-r--r--htroot/yacychat.html14
2 files changed, 17 insertions, 7 deletions
diff --git a/htroot/LLMSelection_p.html b/htroot/LLMSelection_p.html
index de0c9deea..4c77e4d21 100644
--- a/htroot/LLMSelection_p.html
+++ b/htroot/LLMSelection_p.html
@@ -177,6 +177,10 @@
}
}
+ function capabilityLabelToBoolean(label) {
+ return (label || "").trim().toLowerCase() === "yes";
+ }
+
function isCapabilityUnsupportedError(error) {
const status = error && typeof error.status === "number" ? error.status : null;
return status === 400 || status === 404 || status === 415 || status === 422;
@@ -931,9 +935,11 @@
}
const rowData = {};
PRODUCTION_MODEL_COLUMN_NAMES.forEach((columnName, index) => {
- if (index >= PRODUCTION_MODEL_USAGE_COLUMN_START && index <= PRODUCTION_MODEL_FEATURE_COLUMN_END) {
+ if (index >= PRODUCTION_MODEL_FEATURE_COLUMN_START && index <= PRODUCTION_MODEL_FEATURE_COLUMN_END) {
+ rowData[columnName] = capabilityLabelToBoolean(row.cells[index] ? row.cells[index].textContent : "");
+ } else if (index >= PRODUCTION_MODEL_USAGE_COLUMN_START && index <= PRODUCTION_MODEL_USAGE_COLUMN_END) {
const checkbox = row.cells[index] ? row.cells[index].querySelector('input[type="checkbox"]') : null;
- rowData[columnName] = checkbox && (index >= PRODUCTION_MODEL_FEATURE_COLUMN_START || isSelectableUsageColumn(index)) ? checkbox.checked : false;
+ rowData[columnName] = checkbox && isSelectableUsageColumn(index) ? checkbox.checked : false;
} else {
rowData[columnName] = row.cells[index] ? row.cells[index].textContent.trim() : "";
}
diff --git a/htroot/yacychat.html b/htroot/yacychat.html
index 3ac314d04..d94fc2a8b 100644
--- a/htroot/yacychat.html
+++ b/htroot/yacychat.html
@@ -1716,14 +1716,12 @@
messages: sanitizedUserMessage ? [...sanitizedMessages, sanitizedUserMessage] : sanitizedMessages,
stream: true
};
- console.debug('[yacychat] payload search modes', payload.messages.map(m => ({ role: m.role, search: m.search })));
const headers = { 'Content-Type': 'application/json' };
const response = await fetch(state.config.apiHost.replace(/\/$/, '') + '/v1/chat/completions', {
method: 'POST',
headers,
body: JSON.stringify(payload)
});
- console.debug('[yacychat] request ms', Math.round(performance.now() - requestStart));
if (!response.ok) {
if (response.status === 429) {
throw new Error('Rate limit reached: please wait and try again. The server is protecting itself from overload.');
@@ -1761,7 +1759,6 @@
const searchName = parsed['search-filename'];
const searchBase64 = parsed['search-text-base64'];
if (!searchName || !searchBase64) return;
- console.debug('[yacychat] received search attachment', { searchName, size: searchBase64.length, ms: Math.round(performance.now() - requestStart) });
const dataUrl = `data:text/markdown;base64,${searchBase64}`;
const textContent = base64ToUtf8(searchBase64);
for (let i = state.messages.length - 1; i >= 0; i--) {
@@ -1801,8 +1798,16 @@
try {
const parsed = JSON.parse(clean);
applySearchAttachment(parsed);
+ if (Array.isArray(parsed['tool-calls']) && parsed['tool-calls'].length > 0) {
+ const injectedToolCalls = normalizeToolCalls(parsed['tool-calls']);
+ if (injectedToolCalls.length > 0) {
+ collectedToolCalls = injectedToolCalls;
+ roundToolCalls = [];
+ }
+ }
if (Array.isArray(parsed['tool-results']) && parsed['tool-results'].length > 0) {
- collectedToolResults = collectedToolResults.concat(normalizeToolResults(parsed['tool-results']));
+ const normalizedResults = normalizeToolResults(parsed['tool-results']);
+ collectedToolResults = collectedToolResults.concat(normalizedResults);
}
const choice = parsed?.choices?.[0];
const delta = choice?.delta;
@@ -1926,7 +1931,6 @@
: `Tool call: ${normalizedToolCalls.map(call => call?.function?.name || 'tool').join(', ')}`;
}
state.messages.push(assistantMessage);
- console.debug('[yacychat] response chars', assistantText.length, 'total ms', Math.round(performance.now() - requestStart));
state.assistantSeen = true;
persistConversation();
updateClearChatVisibility();