Skip to content

Commit

Permalink
🐛 fix: 优化 model tag 展示逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Jul 22, 2023
1 parent ac4b2f3 commit 3463ede
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/pages/chat/[id]/Conversation/MessageExtra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ const MessageExtra = ({ role, extra }: ChatMessage): ReactNode => {

const [model] = useSessionStore((s) => [agentSelectors.currentAgentModel(s)], shallow);

// 只有 ai 的 message 才会需要展示
if (role !== 'assistant') return;
// 只有当 当前的 model 和 fromModel 不一致时,才需要展示
if (extra?.fromModel && model === extra?.fromModel) return;

return (
<Flexbox className={styles.container}>
<div>
<Tag bordered={false} style={{ borderRadius: 6 }}>
{extra?.fromModel}
</Tag>
</div>
</Flexbox>
);
// 1. 只有 ai 的 message
// 2. 且存在 fromModel
// 3. 且当前的 model 和 fromModel 不一致时
if (role === 'assistant' && extra?.fromModel && model !== extra?.fromModel)
// 才需要展示 model tag
return (
<Flexbox className={styles.container}>
<div>
<Tag bordered={false} style={{ borderRadius: 6 }}>
{extra?.fromModel}
</Tag>
</div>
</Flexbox>
);
};

export default MessageExtra;

0 comments on commit 3463ede

Please sign in to comment.