mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-06-22 01:38:47 +00:00
refactor: remove unused deepseekChat.ts in favor
of reasoningChatModel.ts and messageProcessor.ts in favor of alternaitngMessageValidator.ts - Removed src/lib/deepseekChat.ts as it was duplicative - All functionality is now handled by reasoningChatModel.ts - No imports or references to deepseekChat.ts found in codebase - Removed src/utils/messageProcessor.ts as it was duplicative - All functionality is now handled by alternatingMessaageValidator.ts - No imports or references messageProcessor.ts found in codebase
This commit is contained in:
@ -47,34 +47,21 @@ const MessageBox = ({
|
||||
const [isThinkingExpanded, setIsThinkingExpanded] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
logger.info(`Processing message:`, {
|
||||
content: message.content,
|
||||
role: message.role,
|
||||
messageId: message.messageId
|
||||
});
|
||||
|
||||
const regex = /\[(\d+)\]/g;
|
||||
const thinkRegex = /<think>(.*?)(?:<\/think>|$)(.*)/s;
|
||||
|
||||
// Check for thinking content, including partial tags
|
||||
const match = message.content.match(thinkRegex);
|
||||
logger.info(`Think tag match:`, match);
|
||||
|
||||
if (match) {
|
||||
const [_, thinkingContent, answerContent] = match;
|
||||
|
||||
// Set thinking content even if </think> hasn't appeared yet
|
||||
if (thinkingContent) {
|
||||
logger.info(`Found thinking content:`, thinkingContent.trim());
|
||||
setThinking(thinkingContent.trim());
|
||||
setIsThinkingExpanded(true); // Expand when thinking starts
|
||||
setIsThinkingExpanded(true);
|
||||
}
|
||||
|
||||
// Only set answer content if we have it (after </think>)
|
||||
if (answerContent) {
|
||||
logger.info(`Found answer content:`, answerContent.trim());
|
||||
setIsThinkingExpanded(false); // Collapse when thinking is done
|
||||
// Process the answer part for sources if needed
|
||||
setIsThinkingExpanded(false);
|
||||
if (message.role === 'assistant' && message?.sources && message.sources.length > 0) {
|
||||
setParsedMessage(
|
||||
answerContent.trim().replace(
|
||||
@ -89,7 +76,6 @@ const MessageBox = ({
|
||||
setSpeechMessage(answerContent.trim().replace(regex, ''));
|
||||
}
|
||||
} else {
|
||||
// No thinking content - process as before
|
||||
if (message.role === 'assistant' && message?.sources && message.sources.length > 0) {
|
||||
setParsedMessage(
|
||||
message.content.replace(
|
||||
|
Reference in New Issue
Block a user