mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
feat(chat): support other local llm #331
This commit is contained in:
parent
08631437ee
commit
3b116b3654
4 changed files with 356 additions and 361 deletions
|
@ -39,17 +39,6 @@ func MakeChatCompletionRequest(c *gin.Context) {
|
|||
c.Writer.Header().Set("Connection", "keep-alive")
|
||||
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
|
||||
if settings.OpenAISettings.Token == "" {
|
||||
c.Stream(func(w io.Writer) bool {
|
||||
c.SSEvent("message", gin.H{
|
||||
"type": "error",
|
||||
"content": "[Error] OpenAI token is empty",
|
||||
})
|
||||
return false
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
config := openai.DefaultConfig(settings.OpenAISettings.Token)
|
||||
|
||||
if settings.OpenAISettings.Proxy != "" {
|
||||
|
|
1
app/components.d.ts
vendored
1
app/components.d.ts
vendored
|
@ -8,6 +8,7 @@ export {}
|
|||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
AAlert: typeof import('ant-design-vue/es')['Alert']
|
||||
AAutoComplete: typeof import('ant-design-vue/es')['AutoComplete']
|
||||
AAvatar: typeof import('ant-design-vue/es')['Avatar']
|
||||
ABadge: typeof import('ant-design-vue/es')['Badge']
|
||||
ABreadcrumb: typeof import('ant-design-vue/es')['Breadcrumb']
|
||||
|
|
|
@ -4,25 +4,30 @@ import type { Settings } from '@/views/preference/typedef'
|
|||
|
||||
const data: Settings = inject('data')!
|
||||
const errors: Record<string, Record<string, string>> = inject('errors') as Record<string, Record<string, string>>
|
||||
|
||||
const models = shallowRef([
|
||||
{
|
||||
value: 'gpt-4-1106-preview',
|
||||
},
|
||||
{
|
||||
value: 'gpt-4',
|
||||
},
|
||||
{
|
||||
value: 'gpt-4-32k',
|
||||
},
|
||||
{
|
||||
value: 'gpt-3.5-turbo',
|
||||
},
|
||||
])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AForm layout="vertical">
|
||||
<AFormItem :label="$gettext('ChatGPT Model')">
|
||||
<ASelect v-model:value="data.openai.model">
|
||||
<ASelectOption value="gpt-4-1106-preview">
|
||||
{{ $gettext('GPT-4-Turbo') }}
|
||||
</ASelectOption>
|
||||
<ASelectOption value="gpt-4">
|
||||
{{ $gettext('GPT-4') }}
|
||||
</ASelectOption>
|
||||
<ASelectOption value="gpt-4-32k">
|
||||
{{ $gettext('GPT-4-32K') }}
|
||||
</ASelectOption>
|
||||
<ASelectOption value="gpt-3.5-turbo">
|
||||
{{ $gettext('GPT-3.5-Turbo') }}
|
||||
</ASelectOption>
|
||||
</ASelect>
|
||||
<AFormItem :label="$gettext('Model')">
|
||||
<AAutoComplete
|
||||
v-model:value="data.openai.model"
|
||||
:options="models"
|
||||
/>
|
||||
</AFormItem>
|
||||
<AFormItem
|
||||
:label="$gettext('API Base Url')"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue