fix(room): improve AI label fallback to never show "Unknown AI"

Fallback chain: modelName -> short model ID (no provider) -> 'AI'
This commit is contained in:
ZhenYi 2026-04-28 11:01:51 +08:00
parent 8a6ec1f62f
commit 64ca5eeea1
2 changed files with 8 additions and 2 deletions

View File

@ -171,7 +171,10 @@ export const DiscordMemberList = memo(function DiscordMemberList({
icon={<Bot className="h-3 w-3" />}
>
{aiConfigs.map((ai) => {
const label = ai.modelName || 'Unknown AI';
// Fallback: try modelName, then short model ID (no provider prefix), then 'AI'
const label = ai.modelName
|| ai.model?.split('/').pop()
|| 'AI';
return (
<button
key={ai.model}

View File

@ -147,7 +147,10 @@ export const MessageInput = forwardRef<MessageInputHandle, MessageInputProps>(fu
channels: [] as { id: string; label: string; type: 'channel'; avatar?: string }[],
ai: roomAiConfigs.map((cfg) => ({
id: cfg.model,
label: cfg.modelName || 'Unknown AI',
// Fallback: try modelName, then short model ID (no provider prefix), then 'AI'
label: cfg.modelName
|| cfg.model?.split('/').pop()
|| 'AI',
type: 'ai' as const,
})),
repos: projectRepos.map((r) => ({