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
orangecat
ollama
Commits
8ea5e5e1
"projects/TR3D/tr3d/axis_aligned_iou_loss.py" did not exist on "c2fe651fe62dfbc3ad41f4b2f46709c81c14401c"
Commit
8ea5e5e1
authored
Jul 05, 2023
by
Bruce MacDonald
Committed by
Jeffrey Morgan
Jul 06, 2023
Browse files
separate routes
parent
fd962a36
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
35 deletions
+44
-35
server/routes.go
server/routes.go
+44
-35
No files found.
server/routes.go
View file @
8ea5e5e1
...
@@ -14,15 +14,17 @@ import (
...
@@ -14,15 +14,17 @@ import (
"github.com/jmorganca/ollama/api"
"github.com/jmorganca/ollama/api"
)
)
func
Serve
(
ln
net
.
Listener
)
error
{
func
pull
(
c
*
gin
.
Context
)
{
r
:=
gin
.
Default
()
// TODO
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"message"
:
"ok"
})
}
func
generate
(
c
*
gin
.
Context
)
{
// TODO: these should be request parameters
// TODO: these should be request parameters
gpulayers
:=
0
gpulayers
:=
0
tokens
:=
512
tokens
:=
512
threads
:=
runtime
.
NumCPU
()
threads
:=
runtime
.
NumCPU
()
r
.
POST
(
"/api/generate"
,
func
(
c
*
gin
.
Context
)
{
// TODO: set prompt from template
// TODO: set prompt from template
fmt
.
Println
(
"Generating text..."
)
fmt
.
Println
(
"Generating text..."
)
...
@@ -61,7 +63,14 @@ func Serve(ln net.Listener) error {
...
@@ -61,7 +63,14 @@ func Serve(ln net.Listener) error {
c
.
SSEvent
(
"token"
,
tok
)
c
.
SSEvent
(
"token"
,
tok
)
return
true
return
true
})
})
})
}
func
Serve
(
ln
net
.
Listener
)
error
{
r
:=
gin
.
Default
()
r
.
POST
(
"api/pull"
,
pull
)
r
.
POST
(
"/api/generate"
,
generate
)
log
.
Printf
(
"Listening on %s"
,
ln
.
Addr
())
log
.
Printf
(
"Listening on %s"
,
ln
.
Addr
())
s
:=
&
http
.
Server
{
s
:=
&
http
.
Server
{
...
...
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