fix: strip tags from output (#978)

This commit is contained in:
Jeremy 2025-05-02 16:45:26 -07:00 committed by GitHub
parent 575c12503c
commit e529d99974
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 3 deletions

View file

@ -12,7 +12,7 @@ import { MessageActions } from './message-actions';
import { PreviewAttachment } from './preview-attachment'; import { PreviewAttachment } from './preview-attachment';
import { Weather } from './weather'; import { Weather } from './weather';
import equal from 'fast-deep-equal'; import equal from 'fast-deep-equal';
import { cn } from '@/lib/utils'; import { cn, sanitizeText } from '@/lib/utils';
import { Button } from './ui/button'; import { Button } from './ui/button';
import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip'; import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip';
import { MessageEditor } from './message-editor'; import { MessageEditor } from './message-editor';
@ -130,7 +130,7 @@ const PurePreviewMessage = ({
message.role === 'user', message.role === 'user',
})} })}
> >
<Markdown>{part.text}</Markdown> <Markdown>{sanitizeText(part.text)}</Markdown>
</div> </div>
</div> </div>
); );

View file

@ -73,3 +73,7 @@ export function getTrailingMessageId({
return trailingMessage.id; return trailingMessage.id;
} }
export function sanitizeText(text: string) {
return text.replace('<has_function_call>', '');
}

View file

@ -1,6 +1,6 @@
{ {
"name": "ai-chatbot", "name": "ai-chatbot",
"version": "3.0.17", "version": "3.0.18",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev --turbo", "dev": "next dev --turbo",