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
1a29e9a8
Unverified
Commit
1a29e9a8
authored
Jun 06, 2024
by
royjhan
Committed by
GitHub
Jun 06, 2024
Browse files
API app/browser access (#4879)
* API app/browser access * Add tauri (resolves #2291, #4791, #3799, #4388)
parent
4bf1da49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
envconfig/config.go
envconfig/config.go
+6
-0
server/routes.go
server/routes.go
+4
-0
No files found.
envconfig/config.go
View file @
1a29e9a8
...
@@ -190,6 +190,12 @@ func LoadConfig() {
...
@@ -190,6 +190,12 @@ func LoadConfig() {
)
)
}
}
AllowOrigins
=
append
(
AllowOrigins
,
"app://*"
,
"file://*"
,
"tauri://*"
,
)
maxRunners
:=
clean
(
"OLLAMA_MAX_LOADED_MODELS"
)
maxRunners
:=
clean
(
"OLLAMA_MAX_LOADED_MODELS"
)
if
maxRunners
!=
""
{
if
maxRunners
!=
""
{
m
,
err
:=
strconv
.
Atoi
(
maxRunners
)
m
,
err
:=
strconv
.
Atoi
(
maxRunners
)
...
...
server/routes.go
View file @
1a29e9a8
...
@@ -960,6 +960,10 @@ func (s *Server) GenerateRoutes() http.Handler {
...
@@ -960,6 +960,10 @@ func (s *Server) GenerateRoutes() http.Handler {
config
.
AllowWildcard
=
true
config
.
AllowWildcard
=
true
config
.
AllowBrowserExtensions
=
true
config
.
AllowBrowserExtensions
=
true
config
.
AllowHeaders
=
[]
string
{
"Authorization"
,
"Content-Type"
,
"User-Agent"
,
"Accept"
,
"X-Requested-With"
}
config
.
AllowHeaders
=
[]
string
{
"Authorization"
,
"Content-Type"
,
"User-Agent"
,
"Accept"
,
"X-Requested-With"
}
openAIProperties
:=
[]
string
{
"lang"
,
"package-version"
,
"os"
,
"arch"
,
"runtime"
,
"runtime-version"
,
"async"
}
for
_
,
prop
:=
range
openAIProperties
{
config
.
AllowHeaders
=
append
(
config
.
AllowHeaders
,
"x-stainless-"
+
prop
)
}
config
.
AllowOrigins
=
envconfig
.
AllowOrigins
config
.
AllowOrigins
=
envconfig
.
AllowOrigins
r
:=
gin
.
Default
()
r
:=
gin
.
Default
()
...
...
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