Merge pull request #83 from router-for-me/oaifix
fix(cliproxy): Use model name as fallback for ID if alias is empty
This commit is contained in:
@@ -12,6 +12,9 @@ remote-management:
|
|||||||
# Leave empty to disable the Management API entirely (404 for all /v0/management routes).
|
# Leave empty to disable the Management API entirely (404 for all /v0/management routes).
|
||||||
secret-key: ""
|
secret-key: ""
|
||||||
|
|
||||||
|
# Disable the bundled management control panel asset download and HTTP route when true.
|
||||||
|
disable-control-panel: false
|
||||||
|
|
||||||
# Authentication directory (supports ~ for home directory)
|
# Authentication directory (supports ~ for home directory)
|
||||||
auth-dir: "~/.cli-proxy-api"
|
auth-dir: "~/.cli-proxy-api"
|
||||||
|
|
||||||
|
|||||||
@@ -534,8 +534,13 @@ func (s *Service) registerModelsForAuth(a *coreauth.Auth) {
|
|||||||
ms := make([]*ModelInfo, 0, len(compat.Models))
|
ms := make([]*ModelInfo, 0, len(compat.Models))
|
||||||
for j := range compat.Models {
|
for j := range compat.Models {
|
||||||
m := compat.Models[j]
|
m := compat.Models[j]
|
||||||
|
// Use alias as model ID, fallback to name if alias is empty
|
||||||
|
modelID := m.Alias
|
||||||
|
if modelID == "" {
|
||||||
|
modelID = m.Name
|
||||||
|
}
|
||||||
ms = append(ms, &ModelInfo{
|
ms = append(ms, &ModelInfo{
|
||||||
ID: m.Alias,
|
ID: modelID,
|
||||||
Object: "model",
|
Object: "model",
|
||||||
Created: time.Now().Unix(),
|
Created: time.Now().Unix(),
|
||||||
OwnedBy: compat.Name,
|
OwnedBy: compat.Name,
|
||||||
|
|||||||
Reference in New Issue
Block a user