mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-12 02:45:49 +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("Connection", "keep-alive")
|
||||||
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
|
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)
|
config := openai.DefaultConfig(settings.OpenAISettings.Token)
|
||||||
|
|
||||||
if settings.OpenAISettings.Proxy != "" {
|
if settings.OpenAISettings.Proxy != "" {
|
||||||
|
|
1
app/components.d.ts
vendored
1
app/components.d.ts
vendored
|
@ -8,6 +8,7 @@ export {}
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
AAlert: typeof import('ant-design-vue/es')['Alert']
|
AAlert: typeof import('ant-design-vue/es')['Alert']
|
||||||
|
AAutoComplete: typeof import('ant-design-vue/es')['AutoComplete']
|
||||||
AAvatar: typeof import('ant-design-vue/es')['Avatar']
|
AAvatar: typeof import('ant-design-vue/es')['Avatar']
|
||||||
ABadge: typeof import('ant-design-vue/es')['Badge']
|
ABadge: typeof import('ant-design-vue/es')['Badge']
|
||||||
ABreadcrumb: typeof import('ant-design-vue/es')['Breadcrumb']
|
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 data: Settings = inject('data')!
|
||||||
const errors: Record<string, Record<string, string>> = inject('errors') as Record<string, Record<string, string>>
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AForm layout="vertical">
|
<AForm layout="vertical">
|
||||||
<AFormItem :label="$gettext('ChatGPT Model')">
|
<AFormItem :label="$gettext('Model')">
|
||||||
<ASelect v-model:value="data.openai.model">
|
<AAutoComplete
|
||||||
<ASelectOption value="gpt-4-1106-preview">
|
v-model:value="data.openai.model"
|
||||||
{{ $gettext('GPT-4-Turbo') }}
|
:options="models"
|
||||||
</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>
|
</AFormItem>
|
||||||
<AFormItem
|
<AFormItem
|
||||||
:label="$gettext('API Base Url')"
|
:label="$gettext('API Base Url')"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue