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 += `