Browse Source

API app/browser access (#4879)

* API app/browser access

* Add tauri (resolves #2291, #4791, #3799, #4388)
jmorganca/no-error-template
royjhan 2 years ago
committed by GitHub
parent
commit
1a29e9a879
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      envconfig/config.go
  2. 4
      server/routes.go

6
envconfig/config.go

@ -190,6 +190,12 @@ func LoadConfig() {
)
}
AllowOrigins = append(AllowOrigins,
"app://*",
"file://*",
"tauri://*",
)
maxRunners := clean("OLLAMA_MAX_LOADED_MODELS")
if maxRunners != "" {
m, err := strconv.Atoi(maxRunners)

4
server/routes.go

@ -960,6 +960,10 @@ func (s *Server) GenerateRoutes() http.Handler {
config.AllowWildcard = true
config.AllowBrowserExtensions = true
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
r := gin.Default()

Loading…
Cancel
Save