Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

do not HTML-escape prompt

Quinn Slack62d29b2157d8
diff --git a/server/images.go b/server/images.go
index 40e38256b..a3b3eb4cc 100644
--- a/server/images.go
+++ b/server/images.go
@@ -9,7 +9,6 @@ import (
"encoding/json"
"errors"
"fmt"
- "html/template"
"io"
"log"
"net/http"
@@ -21,6 +20,7 @@ import (
"runtime"
"strconv"
"strings"
+ "text/template"
"github.com/jmorganca/ollama/api"
"github.com/jmorganca/ollama/llm"
diff --git a/server/images_test.go b/server/images_test.go
new file mode 100644
index 000000000..eb3c32d98
--- /dev/null
+++ b/server/images_test.go
@@ -0,0 +1,23 @@
+package server
+
+import (
+ "testing"
+
+ "github.com/jmorganca/ollama/api"
+)
+
+func TestModelPrompt(t *testing.T) {
+ var m Model
+ req := api.GenerateRequest{
+ Template: "a{{ .Prompt }}b",
+ Prompt: "<h1>",
+ }
+ s, err := m.Prompt(req, "")
+ if err != nil {
+ t.Fatal(err)
+ }
+ want := "a<h1>b"
+ if s != want {
+ t.Errorf("got %q, want %q", s, want)
+ }
+}