File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -196,20 +196,25 @@ func updatePricing() {
196196 modelSupportEndpointsStr [ability .Model ] = endpoints
197197 }
198198
199- // 再补充模型自定义端点
199+ // 再补充模型自定义端点:若配置有效则替换默认端点,不做合并
200200 for modelName , meta := range metaMap {
201201 if strings .TrimSpace (meta .Endpoints ) == "" {
202202 continue
203203 }
204204 var raw map [string ]interface {}
205205 if err := json .Unmarshal ([]byte (meta .Endpoints ), & raw ); err == nil {
206- endpoints := modelSupportEndpointsStr [modelName ]
207- for k := range raw {
208- if ! common .StringsContains (endpoints , k ) {
209- endpoints = append (endpoints , k )
206+ endpoints := make ([]string , 0 , len (raw ))
207+ for k , v := range raw {
208+ switch v .(type ) {
209+ case string , map [string ]interface {}:
210+ if ! common .StringsContains (endpoints , k ) {
211+ endpoints = append (endpoints , k )
212+ }
210213 }
211214 }
212- modelSupportEndpointsStr [modelName ] = endpoints
215+ if len (endpoints ) > 0 {
216+ modelSupportEndpointsStr [modelName ] = endpoints
217+ }
213218 }
214219 }
215220
You can’t perform that action at this time.
0 commit comments