From d980b156d9668ae4ec7cd5570bcced9ce0a7cafe Mon Sep 17 00:00:00 2001 From: lehel Date: Wed, 1 Oct 2025 21:54:49 +0200 Subject: [PATCH] ui --- Makefile | 31 +++++++++++++++++++++++++++++++ ui.html | 33 ++++++++++++++++++++------------- visits.bleve/store/root.bolt | Bin 262144 -> 262144 bytes 3 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..92c6b78 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +# Makefile for running the Vet Clinic Chat Assistant locally with Ollama + +.PHONY: run ollama-start ollama-stop ollama-pull ollama-status + +# Start Ollama server (if not already running) +ollama-start: + ollama serve & + @echo "Ollama server started." + +# Stop Ollama server +ollama-stop: + pkill -f "ollama serve" || true + @echo "Ollama server stopped." + +# Pull a model (default: llama3) +ollama-pull: + ollama pull qwen3:latest + +# Show Ollama status +ollama-status: + ollama list + +# Run the Go server (assumes Ollama is running) +run: ollama-pull + OPENAI_API_KEY=ollama OPENAI_BASE_URL=http://localhost:11434/v1 OPENAI_MODEL=llama3 go run . + +# Run tests +.PHONY: test + +test: + go test ./... diff --git a/ui.html b/ui.html index 13d9b3b..85dc22a 100644 --- a/ui.html +++ b/ui.html @@ -18,10 +18,14 @@ const messages = document.getElementById('messages'); const input = document.getElementById('input'); const send = document.getElementById('send'); - function appendMsg(text, who) { + function appendMsg(text, who, isHtml) { const div = document.createElement('div'); div.className = who === 'user' ? 'text-gray-800 mb-2' : 'text-green-700 mb-2'; - div.textContent = text; + if (isHtml) { + div.innerHTML = text; + } else { + div.textContent = text; + } messages.appendChild(div); messages.scrollTop = messages.scrollHeight; } @@ -39,22 +43,25 @@ const data = await resp.json(); messages.lastChild.remove(); // remove 'Thinking...' if (data.match) { - let txt = ''; - txt += `Match: ${data.match}\n`; + let html = ''; + html += `
Match: ${data.match}
`; if (data.notes) { - txt += `\nNotes: ${data.notes}\n`; + html += `
Notes: ${data.notes}
`; } if (data.procedures && data.procedures.length > 0) { - txt += `\nProcedures:\n`; - data.procedures.forEach(function(p, idx) { - txt += ` ${idx+1}. ${p.name}\n`; - txt += ` Cost: ${p.price} Ft\n`; - txt += ` Time: ${p.duration_minutes} min\n`; - if (p.note && p.note.trim()) txt += ` Note: ${p.note}\n`; + html += `
Procedures:
`; + html += `
    `; + data.procedures.forEach(function(p) { + html += `
  1. ${p.name}
    `; + html += `Cost: ${p.price} Ft`; + html += `Time: ${p.duration_minutes} min`; + if (p.note && p.note.trim()) html += `Note: ${p.note}`; + html += `
  2. `; }); - txt += `\nTotal: ${data.total_price} Ft, ${data.total_duration} min\n`; + html += `
`; + html += `
Total: ${data.total_price} Ft, ${data.total_duration} min
`; } - appendMsg(txt, 'bot'); + appendMsg(html, 'bot', true); } else { appendMsg(data.reply || 'No match found.', 'bot'); } diff --git a/visits.bleve/store/root.bolt b/visits.bleve/store/root.bolt index 6955f031fb5178319dbaca767a6f20c204b030a5..57907612ff2ffbc93725db58a54c14cb93708e24 100644 GIT binary patch delta 446 zcmZo@5NK!+n4rMOIZ;twz=#0?4jR0(@4U7#Ze!qj`^o?96(=ePOmkr5kl=>O8$#*k z)k1uaQ*M5SsH@lI>;_6O09zdD}h?${$`^mo>mAFkTt&C0dj4aGd zjW=r^x^6r9|Ne=LU7IH!=wVcY$Qc`(7@8Ps8yHy`7?e~Nq*f&sl%*CGXXfVt4H95j zFxjy|V{&$r3Zup52~7pIQy3?p={GeuGc_k#Kgf@g0#H|SK;6m-rMW$bYaJ~KH|MrTE9MeDAGl@%ZL*;d$ zbj_}h38i~evmol~btmf_NZCB0A&7DEql4CJMrKw<26~1j1{Riv+6G2e1_mXS1*uhu z1!bv4#hLkeKtlu==1g{M(3qTkNQKd4^MpeMwv!G_U`*OP@jwqF4^+RIfq{|PW{sxn zwo@3<(;Aq##F@cbS)m4SKxs~pl8p%quwVfu E0Q^{Gc>n+a