fix: add model display name

This commit is contained in:
wolfkill
2026-05-28 18:36:38 +08:00
committed by lyingbug
parent 4e58dd42cc
commit 43565c5d1b
21 changed files with 187 additions and 46 deletions
+20
View File
@@ -0,0 +1,20 @@
package handler
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestModelUpdateRequestDisplayNamePresence(t *testing.T) {
var omitted UpdateModelRequest
require.NoError(t, json.Unmarshal([]byte(`{"name":"gpt-4o"}`), &omitted))
assert.Nil(t, omitted.DisplayName)
var cleared UpdateModelRequest
require.NoError(t, json.Unmarshal([]byte(`{"display_name":""}`), &cleared))
require.NotNil(t, cleared.DisplayName)
assert.Equal(t, "", *cleared.DisplayName)
}