File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from pydantic import field_validator
12from pydantic_settings import BaseSettings
23
34
@@ -9,5 +10,12 @@ class Settings(BaseSettings):
910
1011 model_config = {"env_file" : ".env" , "env_file_encoding" : "utf-8" }
1112
13+ @field_validator ("cors_origins" , mode = "before" )
14+ @classmethod
15+ def parse_cors_origins (cls , v : object ) -> list [str ]:
16+ if isinstance (v , str ):
17+ return [o .strip () for o in v .split ("," ) if o .strip ()]
18+ return v # type: ignore[return-value]
19+
1220
1321settings = Settings ()
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import type {
1111 SummarizeResponse ,
1212} from "@/types/api"
1313
14- const BASE_URL = process . env . NEXT_PUBLIC_API_URL ?? "http://localhost:8000"
14+ const BASE_URL = ( process . env . NEXT_PUBLIC_API_URL ?? "http://localhost:8000" ) . replace ( / \/ $ / , "" )
1515
1616async function request < T > ( path : string , options ?: RequestInit ) : Promise < T > {
1717 const res = await fetch ( `${ BASE_URL } ${ path } ` , {
You can’t perform that action at this time.
0 commit comments