Skip to content

Commit 8376995

Browse files
perf: Uvicorn bind template
1 parent b009779 commit 8376995

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

backend/common/utils/whitelist.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,20 @@
66
"/docs",
77
"/login/*",
88
"*.json",
9-
"*.ico"
9+
"*.ico",
10+
"*.html",
11+
"*.js",
12+
"*.css",
13+
"*.png",
14+
"*.jpg",
15+
"*.jpeg",
16+
"*.gif",
17+
"*.svg",
18+
"*.woff",
19+
"*.woff2",
20+
"*.ttf",
21+
"*.eot",
22+
"*.otf"
1023
]
1124

1225
class WhitelistChecker:

backend/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from fastapi.staticfiles import StaticFiles
12
import sentry_sdk
23
from fastapi import FastAPI
34
from fastapi.routing import APIRoute
@@ -28,9 +29,10 @@ def custom_generate_unique_id(route: APIRoute) -> str:
2829
allow_methods=["*"],
2930
allow_headers=["*"],
3031
)
32+
3133
app.add_middleware(TokenMiddleware)
3234
app.include_router(api_router, prefix=settings.API_V1_STR)
33-
35+
app.mount("/", StaticFiles(directory='../frontend/dist'), name="static")
3436
if __name__ == "__main__":
3537
import uvicorn
3638
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)

frontend/.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
VITE_API_BASE_URL=./
1+
VITE_API_BASE_URL=./api/v1
22
VITE_APP_TITLE=SQLBot

frontend/src/router/watch.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const watchRouter = (router: any) => {
1919
return
2020
}
2121
if (to.path === '/login') {
22+
console.log(from)
2223
next('/chat')
2324
} else {
2425
next()

frontend/src/views/setting/Professional.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ const search = () => {
167167
})
168168
}
169169
const addTerm = () => {
170-
termApi.add(state.form).then((res: any) => {
170+
termApi.add(state.form).then(() => {
171171
dialogFormVisible.value = false
172172
search()
173173
ElMessage({

0 commit comments

Comments
 (0)