Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
b4e11be8
Commit
b4e11be8
authored
Jan 31, 2024
by
Michael Yang
Browse files
append image tags to user content
parent
a8960797
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
server/images.go
server/images.go
+6
-1
server/routes.go
server/routes.go
+4
-0
No files found.
server/images.go
View file @
b4e11be8
...
...
@@ -179,8 +179,13 @@ func (m *Model) ChatPrompts(msgs []api.Message) (*ChatHistory, error) {
prompts
=
append
(
prompts
,
currentVars
)
currentVars
=
PromptVars
{}
}
currentVars
.
Prompt
=
msg
.
Content
currentImages
=
msg
.
Images
for
i
:=
range
msg
.
Images
{
currentVars
.
Prompt
+=
fmt
.
Sprintf
(
" [img-%d]"
,
len
(
currentImages
)
+
i
)
}
currentImages
=
append
(
currentImages
,
msg
.
Images
...
)
case
"assistant"
:
currentVars
.
Response
=
msg
.
Content
prompts
=
append
(
prompts
,
currentVars
)
...
...
server/routes.go
View file @
b4e11be8
...
...
@@ -244,6 +244,10 @@ func GenerateHandler(c *gin.Context) {
promptVars
.
System
=
model
.
System
}
for
i
:=
range
req
.
Images
{
promptVars
.
Prompt
+=
fmt
.
Sprintf
(
" [img-%d]"
,
i
)
}
p
,
err
:=
model
.
PreResponsePrompt
(
promptVars
)
if
err
!=
nil
{
c
.
JSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"error"
:
err
.
Error
()})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment