atrokhym commited on
Commit
76713c2
·
1 Parent(s): fe3ea80

fixes for PR #332

Browse files
app/components/chat/UserMessage.tsx CHANGED
@@ -9,10 +9,7 @@ interface UserMessageProps {
9
  }
10
 
11
  export function UserMessage({ content }: UserMessageProps) {
12
- const sanitizedContent = sanitizeUserMessage(content);
13
- const textContent = Array.isArray(sanitizedContent)
14
- ? sanitizedContent.find(item => item.type === 'text')?.text || ''
15
- : sanitizedContent;
16
 
17
  return (
18
  <div className="overflow-hidden pt-[4px]">
@@ -23,17 +20,9 @@ export function UserMessage({ content }: UserMessageProps) {
23
 
24
  function sanitizeUserMessage(content: string | Array<{type: string, text?: string, image_url?: {url: string}}>) {
25
  if (Array.isArray(content)) {
26
- return content.map(item => {
27
- if (item.type === 'text') {
28
- return {
29
- type: 'text',
30
- text: item.text?.replace(/\[Model:.*?\]\n\n/, '').replace(/\[Provider:.*?\]\n\n/, '')
31
- };
32
- }
33
- return item; // Keep image_url items unchanged
34
- });
35
  }
36
 
37
- // Handle legacy string content
38
- return content.replace(/\[Model:.*?\]\n\n/, '').replace(/\[Provider:.*?\]\n\n/, '');
39
- }
 
9
  }
10
 
11
  export function UserMessage({ content }: UserMessageProps) {
12
+ const textContent = sanitizeUserMessage(content);
 
 
 
13
 
14
  return (
15
  <div className="overflow-hidden pt-[4px]">
 
20
 
21
  function sanitizeUserMessage(content: string | Array<{type: string, text?: string, image_url?: {url: string}}>) {
22
  if (Array.isArray(content)) {
23
+ const textItem = content.find(item => item.type === 'text');
24
+ return textItem?.text?.replace(MODEL_REGEX, '').replace(PROVIDER_REGEX, '') || '';
 
 
 
 
 
 
 
25
  }
26
 
27
+ return content.replace(MODEL_REGEX, '').replace(PROVIDER_REGEX, '');
28
+ }
 
app/components/workbench/EditorPanel.tsx CHANGED
@@ -23,6 +23,7 @@ import { isMobile } from '~/utils/mobile';
23
  import { FileBreadcrumb } from './FileBreadcrumb';
24
  import { FileTree } from './FileTree';
25
  import { Terminal, type TerminalRef } from './terminal/Terminal';
 
26
 
27
  interface EditorPanelProps {
28
  files?: FileMap;
@@ -203,7 +204,7 @@ export const EditorPanel = memo(
203
  const isActive = activeTerminal === index;
204
 
205
  return (
206
- <>
207
  {index == 0 ? (
208
  <button
209
  key={index}
@@ -222,7 +223,7 @@ export const EditorPanel = memo(
222
  Bolt Terminal
223
  </button>
224
  ) : (
225
- <>
226
  <button
227
  key={index}
228
  className={classNames(
@@ -238,9 +239,9 @@ export const EditorPanel = memo(
238
  <div className="i-ph:terminal-window-duotone text-lg" />
239
  Terminal {terminalCount > 1 && index}
240
  </button>
241
- </>
242
  )}
243
- </>
244
  );
245
  })}
246
  {terminalCount < MAX_TERMINALS && <IconButton icon="i-ph:plus" size="md" onClick={addTerminal} />}
 
23
  import { FileBreadcrumb } from './FileBreadcrumb';
24
  import { FileTree } from './FileTree';
25
  import { Terminal, type TerminalRef } from './terminal/Terminal';
26
+ import React from 'react';
27
 
28
  interface EditorPanelProps {
29
  files?: FileMap;
 
204
  const isActive = activeTerminal === index;
205
 
206
  return (
207
+ <React.Fragment key={index}>
208
  {index == 0 ? (
209
  <button
210
  key={index}
 
223
  Bolt Terminal
224
  </button>
225
  ) : (
226
+ <React.Fragment>
227
  <button
228
  key={index}
229
  className={classNames(
 
239
  <div className="i-ph:terminal-window-duotone text-lg" />
240
  Terminal {terminalCount > 1 && index}
241
  </button>
242
+ </React.Fragment>
243
  )}
244
+ </React.Fragment>
245
  );
246
  })}
247
  {terminalCount < MAX_TERMINALS && <IconButton icon="i-ph:plus" size="md" onClick={addTerminal} />}
app/lib/.server/llm/stream-text.ts CHANGED
@@ -80,6 +80,11 @@ export function streamText(
80
  return message; // No changes for non-user messages
81
  });
82
 
 
 
 
 
 
83
  return _streamText({
84
  model: getModel(currentProvider, currentModel, env, apiKeys),
85
  system: getSystemPrompt(),
 
80
  return message; // No changes for non-user messages
81
  });
82
 
83
+ console.log('Stream Text:', JSON.stringify({
84
+ model: getModel(currentProvider, currentModel, env, apiKeys),
85
+ messages: convertToCoreMessages(processedMessages),
86
+ }));
87
+
88
  return _streamText({
89
  model: getModel(currentProvider, currentModel, env, apiKeys),
90
  system: getSystemPrompt(),