KI-Chat: Bewerbungsdaten per Tool-Calling nachschlagen statt in Prompt stopfen
Der Systemprompt enthielt früher nur die 12 jüngsten Bewerbungen (LIMIT 12),
daher fand die KI ältere Firmen wie QBS KLIMTAX nicht. Alle Bewerbungen in den
Prompt zu laden machte den Chat sehr langsam, da der Prompt bei jedem Turn
voll neu verarbeitet wird.
Jetzt nutzt der Assistent Ollama-Tool-Calling, um Datenbankdaten on demand
nachzuschlagen. Der Systemprompt bleibt klein und konstant (nur Profil +
Datum), unabhängig von der Anzahl der Bewerbungen.
- lib/chat.js: streamChat mit tools + runChat-Tool-Schleife (max 4 Runden)
- server.js: Tools suche_bewerbungen/list_bewerbungen/bewerbung_detail/
kommende_termine mit SQL-Queries; gatherChatContext auf Kern reduziert
- public/js/chat.js: Tool-Indikator ("durchsucht Bewerbungen…") im UI
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+11
-1
@@ -243,7 +243,17 @@
|
||||
}
|
||||
|
||||
await consumeSSE(res, (ev) => {
|
||||
if (ev.type === 'token') {
|
||||
if (ev.type === 'tool') {
|
||||
// Tool lookups run before the first text token; surface a muted hint
|
||||
// inside the typing indicator so the user sees activity.
|
||||
const typingEl = document.getElementById('typing');
|
||||
if (typingEl && !assistantBubble) {
|
||||
const label = ev.label || ev.name || 'nachschlagen…';
|
||||
typingEl.innerHTML = '<div class="rounded-lg px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-400 text-sm">' +
|
||||
'🔍 ' + escapeHtml(label) + '</div>';
|
||||
}
|
||||
scrollBottom();
|
||||
} else if (ev.type === 'token') {
|
||||
if (!assistantBubble) {
|
||||
if (typing) typing.remove();
|
||||
assistantBubble = addMessage('assistant', '');
|
||||
|
||||
Reference in New Issue
Block a user