Merge pull request #457 from sqs/dont-html-escape-prompt

do not HTML-escape prompt
This commit is contained in:
Michael Yang 2023-09-01 17:41:53 -07:00 committed by GitHub
commit adaa13088b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View file

@ -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"

23
server/images_test.go Normal file
View file

@ -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)
}
}