Skip to content

Commit a72045b

Browse files
committed
feat:(requests) use relative path as the base url #1109
1 parent bba5d37 commit a72045b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

api/openai/openai.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99
"time"
1010

11+
"github.com/0xJacky/Nginx-UI/api"
1112
"github.com/0xJacky/Nginx-UI/internal/llm"
1213
"github.com/0xJacky/Nginx-UI/settings"
1314
"github.com/gin-gonic/gin"
@@ -46,10 +47,7 @@ func MakeChatCompletionRequest(c *gin.Context) {
4647
}
4748

4849
// SSE server
49-
c.Writer.Header().Set("Content-Type", "text/event-stream; charset=utf-8")
50-
c.Writer.Header().Set("Cache-Control", "no-cache")
51-
c.Writer.Header().Set("Connection", "keep-alive")
52-
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
50+
api.SetSSEHeaders(c)
5351

5452
openaiClient, err := llm.GetClient()
5553
if err != nil {

app/src/main.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { autoAnimatePlugin } from '@formkit/auto-animate/vue'
22
import { createCurdConfig } from '@uozi-admin/curd'
3+
import { setRequestConfig } from '@uozi-admin/request'
34
import { createPinia } from 'pinia'
45
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
56
import { createApp } from 'vue'
@@ -24,6 +25,10 @@ function setupTranslations() {
2425
}, {})
2526
}
2627

28+
setRequestConfig({
29+
baseURL: './api',
30+
})
31+
2732
pinia.use(piniaPluginPersistedstate)
2833

2934
app.use(pinia)

0 commit comments

Comments
 (0)