mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: allow admins to override the chat compaction model (#27151)
This commit is contained in:
@@ -12357,6 +12357,16 @@ func TestChatModelOverrides(t *testing.T) {
|
||||
return db.UpsertChatTitleGenerationModelOverride(dbauthz.AsSystemRestricted(ctx), value)
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Compaction",
|
||||
context: codersdk.ChatModelOverrideContextCompaction,
|
||||
dbGet: func(ctx context.Context, db database.Store) (string, error) {
|
||||
return db.GetChatCompactionModelOverride(dbauthz.AsSystemRestricted(ctx))
|
||||
},
|
||||
dbUpsert: func(ctx context.Context, db database.Store, value string) error {
|
||||
return db.UpsertChatCompactionModelOverride(dbauthz.AsSystemRestricted(ctx), value)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, setting := range settings {
|
||||
@@ -12566,7 +12576,7 @@ func TestChatModelOverrides(t *testing.T) {
|
||||
require.Equal(t, "Invalid chat model override context.", sdkErr.Message)
|
||||
require.Equal(
|
||||
t,
|
||||
`Expected one of general, explore, title_generation. Got "not-a-context".`,
|
||||
`Expected one of general, explore, title_generation, compaction. Got "not-a-context".`,
|
||||
sdkErr.Detail,
|
||||
)
|
||||
|
||||
@@ -12575,7 +12585,7 @@ func TestChatModelOverrides(t *testing.T) {
|
||||
require.Equal(t, "Invalid chat model override context.", sdkErr.Message)
|
||||
require.Equal(
|
||||
t,
|
||||
`Expected one of general, explore, title_generation. Got "not-a-context".`,
|
||||
`Expected one of general, explore, title_generation, compaction. Got "not-a-context".`,
|
||||
sdkErr.Detail,
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user