diff --git a/app/components/chat/UserMessage.tsx b/app/components/chat/UserMessage.tsx index d7e1228..c5d9c9b 100644 --- a/app/components/chat/UserMessage.tsx +++ b/app/components/chat/UserMessage.tsx @@ -9,10 +9,7 @@ interface UserMessageProps { } export function UserMessage({ content }: UserMessageProps) { - const sanitizedContent = sanitizeUserMessage(content); - const textContent = Array.isArray(sanitizedContent) - ? sanitizedContent.find(item => item.type === 'text')?.text || '' - : sanitizedContent; + const textContent = sanitizeUserMessage(content); return (
@@ -23,17 +20,9 @@ export function UserMessage({ content }: UserMessageProps) { function sanitizeUserMessage(content: string | Array<{type: string, text?: string, image_url?: {url: string}}>) { if (Array.isArray(content)) { - return content.map(item => { - if (item.type === 'text') { - return { - type: 'text', - text: item.text?.replace(/\[Model:.*?\]\n\n/, '').replace(/\[Provider:.*?\]\n\n/, '') - }; - } - return item; // Keep image_url items unchanged - }); + const textItem = content.find(item => item.type === 'text'); + return textItem?.text?.replace(MODEL_REGEX, '').replace(PROVIDER_REGEX, '') || ''; } - // Handle legacy string content - return content.replace(/\[Model:.*?\]\n\n/, '').replace(/\[Provider:.*?\]\n\n/, ''); -} + return content.replace(MODEL_REGEX, '').replace(PROVIDER_REGEX, ''); +} \ No newline at end of file diff --git a/app/components/workbench/EditorPanel.tsx b/app/components/workbench/EditorPanel.tsx index e789f1d..a9c9d33 100644 --- a/app/components/workbench/EditorPanel.tsx +++ b/app/components/workbench/EditorPanel.tsx @@ -23,6 +23,7 @@ import { isMobile } from '~/utils/mobile'; import { FileBreadcrumb } from './FileBreadcrumb'; import { FileTree } from './FileTree'; import { Terminal, type TerminalRef } from './terminal/Terminal'; +import React from 'react'; interface EditorPanelProps { files?: FileMap; @@ -203,7 +204,7 @@ export const EditorPanel = memo( const isActive = activeTerminal === index; return ( - <> + {index == 0 ? ( - + )} - + ); })} {terminalCount < MAX_TERMINALS && } diff --git a/app/lib/.server/llm/stream-text.ts b/app/lib/.server/llm/stream-text.ts index 1603396..7951512 100644 --- a/app/lib/.server/llm/stream-text.ts +++ b/app/lib/.server/llm/stream-text.ts @@ -80,6 +80,11 @@ export function streamText( return message; // No changes for non-user messages }); + console.log('Stream Text:', JSON.stringify({ + model: getModel(currentProvider, currentModel, env, apiKeys), + messages: convertToCoreMessages(processedMessages), + })); + return _streamText({ model: getModel(currentProvider, currentModel, env, apiKeys), system: getSystemPrompt(),