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
3b521054
Commit
3b521054
authored
Aug 01, 2024
by
Vyacheslav Moskalev
Browse files
Refactor code. Remove extra variable.
parent
b0c21658
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
server/routes.go
server/routes.go
+4
-6
No files found.
server/routes.go
View file @
3b521054
...
...
@@ -187,7 +187,6 @@ func (s *Server) GenerateHandler(c *gin.Context) {
values
.
Messages
=
append
(
msgs
,
api
.
Message
{
Role
:
"user"
,
Content
:
req
.
Prompt
})
}
var
s
string
var
b
bytes
.
Buffer
if
err
:=
tmpl
.
Execute
(
&
b
,
values
);
err
!=
nil
{
c
.
JSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"error"
:
err
.
Error
()})
...
...
@@ -195,16 +194,15 @@ func (s *Server) GenerateHandler(c *gin.Context) {
}
if
req
.
Context
!=
nil
{
prev
,
err
:=
r
.
Detokenize
(
c
.
Request
.
Context
(),
req
.
Context
)
s
,
err
:=
r
.
Detokenize
(
c
.
Request
.
Context
(),
req
.
Context
)
if
err
!=
nil
{
c
.
JSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"error"
:
err
.
Error
()})
return
}
s
+=
prev
prompt
=
s
+
b
.
String
()
}
else
{
prompt
=
b
.
String
();
}
s
+=
b
.
String
();
prompt
=
s
}
slog
.
Debug
(
"generate request"
,
"prompt"
,
prompt
,
"images"
,
images
)
...
...
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