updated parameters and retrieval prompt to massively improve query quality

This commit is contained in:
2026-02-19 15:36:32 +01:00
parent 9abda1d867
commit 08610e0b64
3 changed files with 28 additions and 15 deletions
+14 -8
View File
@@ -9,13 +9,15 @@
body {
font-family: "SF Mono", "Consolas", "Monaco", monospace;
margin: 0;
min-height: 100vh;
height: 100vh;
overflow: hidden;
background: #0f0f12;
color: #e4e4e7;
display: flex;
flex-direction: column;
}
header {
flex-shrink: 0;
padding: 1rem 1.5rem;
border-bottom: 1px solid #27272a;
background: #18181b;
@@ -33,6 +35,7 @@
}
#messages {
flex: 1;
min-height: 0;
overflow-y: auto;
padding: 1.5rem;
display: flex;
@@ -108,6 +111,7 @@
display: block;
}
#input-area {
flex-shrink: 0;
padding: 1rem 1.5rem 1.5rem;
border-top: 1px solid #27272a;
background: #18181b;
@@ -138,6 +142,7 @@
#input {
flex: 1;
min-height: 44px;
height: 44px;
max-height: 160px;
padding: 0.6rem 1rem;
font: inherit;
@@ -152,7 +157,8 @@
#input::placeholder { color: #71717a; }
#input:focus { border-color: #52525b; }
#send {
padding: 0.6rem 1.2rem;
height: 44px;
padding: 0 1.2rem;
font: inherit;
font-size: 0.85rem;
font-weight: 500;
@@ -179,8 +185,8 @@
</head>
<body>
<header>
<h1>Local RAG Chat</h1>
<p>Ask questions about your documents. Answers are generated from the vector store + Ollama / OpenAI.</p>
<h1>RAG Chat</h1>
<p>Ask questions about your documents. Answers are generated from a local vector store + Ollama / OpenAI.</p>
</header>
<div id="messages"></div>
@@ -219,11 +225,11 @@
} catch (_) {}
})();
function appendMessage(role, text, isError = false) {
function appendMessage(role, text, isError = false, llmProvider = null) {
text = text ?? '';
const div = document.createElement('div');
div.className = 'msg ' + (isError ? 'error' : role);
const label = role === 'user' ? 'You' : 'RAG';
let label = role === 'user' ? 'You' : (llmProvider === 'openai' ? 'ChatGPT + RAG' : 'Ollama + RAG');
let body;
if (role === 'assistant' && !isError) {
const rawHtml = marked.parse(text, { gfm: true, breaks: true });
@@ -288,9 +294,9 @@
console.groupEnd();
}
if (data.error) {
appendMessage('assistant', data.error, true);
appendMessage('assistant', data.error, true, providerEl.value);
} else {
appendMessage('assistant', (data.answer || '(No response)').trim());
appendMessage('assistant', (data.answer || '(No response)').trim(), false, providerEl.value);
}
} catch (err) {
setLoading(false);