Added sanitization for user messages.

Use regex defined in constants.ts instead of redefining.
This commit is contained in:
Tommy
2024-11-06 21:35:54 +01:00
parent 074e2f3016
commit 2a362b9e0b
3 changed files with 28 additions and 30 deletions

View File

@@ -1,7 +1,7 @@
// @ts-nocheck
// Preventing TS checks with files presented in the video for a better presentation.
import { modificationsRegex } from '~/utils/diff';
import { MODEL_REGEX } from '~/utils/constants';
import { MODEL_REGEX, PROVIDER_REGEX } from '~/utils/constants';
import { Markdown } from './Markdown';
interface UserMessageProps {
@@ -17,5 +17,5 @@ export function UserMessage({ content }: UserMessageProps) {
}
function sanitizeUserMessage(content: string) {
return content.replace(modificationsRegex, '').replace(MODEL_REGEX, '').trim();
return content.replace(modificationsRegex, '').replace(MODEL_REGEX, '').replace(PROVIDER_REGEX, '').trim();
}