feat: add openai configuration to web ui

This commit is contained in:
100gle
2023-09-28 09:08:17 +08:00
parent bfbf7aed56
commit 03304baea6
3 changed files with 8 additions and 6 deletions

View File

@@ -84,8 +84,8 @@ class Notification(BaseModel):
class Experimental(BaseModel):
openai_enable: bool = Field(False, description="Enable experimental OpenAI")
openai_api_key: str = Field("", description="OpenAI api key")
openai_api_base: str = Field("", description="OpenAI api base url")
openai_model: str = Field("", description="OpenAI model")
openai_api_base: str = Field("https://api.openai.com/v1", description="OpenAI api base url")
openai_model: str = Field("gpt-3.5-turbo", description="OpenAI model")
class Config(BaseModel):
@@ -96,7 +96,7 @@ class Config(BaseModel):
log: Log = Log()
proxy: Proxy = Proxy()
notification: Notification = Notification()
Experimental: Experimental = Experimental()
experimental: Experimental = Experimental()
def dict(self, *args, by_alias=True, **kwargs):
return super().dict(*args, by_alias=by_alias, **kwargs)

View File

@@ -58,10 +58,12 @@ class OpenAIParser:
the OpenAI api base url, you can use custom url here. \
Defaults to "https://api.openai.com/v1".
model (str):
the ChatGPT model parameter, you can get more details from https://platform.openai.com/docs/api-reference/chat/create. \
the ChatGPT model parameter, you can get more details from \
https://platform.openai.com/docs/api-reference/chat/create. \
Defaults to "gpt-3.5-turbo".
kwargs (dict):
the OpenAI ChatGPT parameters, you can get more details from https://platform.openai.com/docs/api-reference/chat/create.
the OpenAI ChatGPT parameters, you can get more details from \
https://platform.openai.com/docs/api-reference/chat/create.
Raises:
ValueError: if api_key is not provided.

View File

@@ -105,7 +105,7 @@ export const initConfig: Config = {
experimental: {
openai_enable: false,
openai_api_key: '',
openai_api_base: '',
openai_api_base: 'https://api.openai.com/v1/',
openai_model: 'gpt-3.5-turbo',
},
};