mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-09-13 10:04:42 +08:00
feat: Added streaming transmission configuration (#7875)
Some checks failed
SonarCloud Scan / SonarCloud (push) Failing after 12m4s
Some checks failed
SonarCloud Scan / SonarCloud (push) Failing after 12m4s
This commit is contained in:
parent
367a74503f
commit
f6ee3dc75b
3 changed files with 27 additions and 12 deletions
|
@ -233,6 +233,9 @@ func (u *AIToolService) BindDomain(req dto.OllamaBindDomain) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
if err = ConfigAIProxy(website); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -1150,17 +1150,17 @@ func GetAllowIps(website model.Website) []string {
|
|||
}
|
||||
|
||||
func ConfigAIProxy(website model.Website) error {
|
||||
// nginxFull, err := getNginxFull(&website)
|
||||
// if err != nil {
|
||||
// return nil
|
||||
// }
|
||||
// config := nginxFull.SiteConfig.Config
|
||||
// server := config.FindServers()[0]
|
||||
// dirs := server.GetDirectives()
|
||||
// for _, dir := range dirs {
|
||||
// if dir.GetName() == "location" && dir.GetParameters()[0] == "/" {
|
||||
// // server.UpdateRootProxy()
|
||||
// }
|
||||
// }
|
||||
nginxFull, err := getNginxFull(&website)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
config := nginxFull.SiteConfig.Config
|
||||
server := config.FindServers()[0]
|
||||
dirs := server.GetDirectives()
|
||||
for _, dir := range dirs {
|
||||
if dir.GetName() == "location" && dir.GetParameters()[0] == "/" {
|
||||
server.UpdateRootProxyForAi([]string{fmt.Sprintf("http://%s", website.Proxy)})
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -291,6 +291,18 @@ func (s *Server) UpdateRootProxyForAi(proxy []string) {
|
|||
"1.1",
|
||||
},
|
||||
},
|
||||
&Directive{
|
||||
Name: "proxy_set_header",
|
||||
Parameters: []string{
|
||||
"Connection", "''",
|
||||
},
|
||||
},
|
||||
&Directive{
|
||||
Name: "chunked_transfer_encoding",
|
||||
Parameters: []string{
|
||||
"off",
|
||||
},
|
||||
},
|
||||
}
|
||||
block.Directives = append(block.Directives, &Directive{
|
||||
Name: "proxy_pass",
|
||||
|
|
Loading…
Add table
Reference in a new issue