🎨 管理指定群组新增模型可选范围限制 #84

Merged
李寻欢 merged 1 commits from hotfix into main 2024-07-16 15:40:20 +08:00
3 changed files with 7 additions and 3 deletions
Showing only changes of commit b794df9b63 - Show all commits

View File

@ -102,6 +102,7 @@ ai:
models: models:
- name: ChatGPT-4 - name: ChatGPT-4
model: gpt-4 model: gpt-4
canManager: false
- name: 讯飞星火v3.1 - name: 讯飞星火v3.1
model: SparkDesk-v3.1 model: SparkDesk-v3.1
- name: 讯飞星火v3.5 - name: 讯飞星火v3.5
@ -116,8 +117,10 @@ ai:
model: StepChat model: StepChat
- name: 豆包Lite-4k - name: 豆包Lite-4k
model: Doubao-lite-4k model: Doubao-lite-4k
canManager: true
- name: 豆包Pro-4k - name: 豆包Pro-4k
model: Doubao-pro-4k model: Doubao-pro-4k
canManager: true
# 资源配置 # 资源配置
# map[k]v结构k 会变成全小写,所以这儿不能用大写字母 # map[k]v结构k 会变成全小写,所以这儿不能用大写字母

View File

@ -17,4 +17,5 @@ type ai struct {
type aiModel struct { type aiModel struct {
Name string `json:"name" yaml:"name"` // 模型名称 Name string `json:"name" yaml:"name"` // 模型名称
Model string `json:"dto" yaml:"dto"` // 模型代码 Model string `json:"dto" yaml:"dto"` // 模型代码
CanManager bool `json:"canManager" yaml:"canManager"` // 是否可以在manager页面中选择
} }

View File

@ -53,7 +53,7 @@
<select class="block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-green-600 sm:text-sm sm:leading-6" onchange="aiModelChange(event, {{.info.Wxid}})"> <select class="block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-green-600 sm:text-sm sm:leading-6" onchange="aiModelChange(event, {{.info.Wxid}})">
{{$useModel := .info.AiModel}} {{$useModel := .info.AiModel}}
{{ range $.aiModels }} {{ range $.aiModels }}
<option value="{{.Model}}" {{ if eq $useModel .Model}}selected{{ end }}> <option value="{{.Model}}" {{ if eq $useModel .Model}}selected{{ end }} {{ if not .CanManager}}disabled{{ end }}>
{{.Name}} {{.Name}}
</option> </option>
{{ end }} {{ end }}