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 6955f03..5790761 100644 Binary files a/visits.bleve/store/root.bolt and b/visits.bleve/store/root.bolt differ