diff --git a/app/components/chat/AssistantMessage.tsx b/app/components/chat/AssistantMessage.tsx index 2d013b86..022b4fbe 100644 --- a/app/components/chat/AssistantMessage.tsx +++ b/app/components/chat/AssistantMessage.tsx @@ -6,6 +6,7 @@ import { workbenchStore } from '~/lib/stores/workbench'; import { WORK_DIR } from '~/utils/constants'; import WithTooltip from '~/components/ui/Tooltip'; import type { Message } from 'ai'; +import type { ProviderInfo } from '~/types/model'; interface AssistantMessageProps { content: string; @@ -16,6 +17,8 @@ interface AssistantMessageProps { append?: (message: Message) => void; chatMode?: 'discuss' | 'build'; setChatMode?: (mode: 'discuss' | 'build') => void; + model?: string; + provider?: ProviderInfo; } function openArtifactInWorkbench(filePath: string) { @@ -43,7 +46,18 @@ function normalizedFilePath(path: string) { } export const AssistantMessage = memo( - ({ content, annotations, messageId, onRewind, onFork, append, chatMode, setChatMode }: AssistantMessageProps) => { + ({ + content, + annotations, + messageId, + onRewind, + onFork, + append, + chatMode, + setChatMode, + model, + provider, + }: AssistantMessageProps) => { const filteredAnnotations = (annotations?.filter( (annotation: JSONValue) => annotation && typeof annotation === 'object' && Object.keys(annotation).includes('type'), @@ -141,7 +155,7 @@ export const AssistantMessage = memo( - + {content} diff --git a/app/components/chat/BaseChat.tsx b/app/components/chat/BaseChat.tsx index e315fdcc..1b2beeaf 100644 --- a/app/components/chat/BaseChat.tsx +++ b/app/components/chat/BaseChat.tsx @@ -359,6 +359,8 @@ export const BaseChat = React.forwardRef( append={append} chatMode={chatMode} setChatMode={setChatMode} + provider={provider} + model={model} /> ) : null; }} diff --git a/app/components/chat/Markdown.tsx b/app/components/chat/Markdown.tsx index 24022286..89ecf8ab 100644 --- a/app/components/chat/Markdown.tsx +++ b/app/components/chat/Markdown.tsx @@ -8,6 +8,7 @@ import { CodeBlock } from './CodeBlock'; import type { Message } from 'ai'; import styles from './Markdown.module.scss'; import ThoughtBox from './ThoughtBox'; +import type { ProviderInfo } from '~/types/model'; const logger = createScopedLogger('MarkdownComponent'); @@ -18,10 +19,12 @@ interface MarkdownProps { append?: (message: Message) => void; chatMode?: 'discuss' | 'build'; setChatMode?: (mode: 'discuss' | 'build') => void; + model?: string; + provider?: ProviderInfo; } export const Markdown = memo( - ({ children, html = false, limitedMarkdown = false, append, setChatMode }: MarkdownProps) => { + ({ children, html = false, limitedMarkdown = false, append, setChatMode, model, provider }: MarkdownProps) => { logger.trace('Render'); const components = useMemo(() => { @@ -106,17 +109,17 @@ export const Markdown = memo( openArtifactInWorkbench(path); } else if (type === 'message' && append) { append({ - id: 'random-message', // Replace with your ID generation logic - content: message as string, // The message content from the action - role: 'user', // Or another role as appropriate + id: `quick-action-message-${Date.now()}`, + content: `[Model: ${model}]\n\n[Provider: ${provider?.name}]\n\n${message}`, + role: 'user', }); - console.log('Message appended:', message); // Log the appended message + console.log('Message appended:', message); } else if (type === 'implement' && append && setChatMode) { setChatMode('build'); append({ - id: 'implement-message', // Replace with your ID generation logic - content: message as string, // The message content from the action - role: 'user', // Or another role as appropriate + id: `quick-action-implement-${Date.now()}`, + content: `[Model: ${model}]\n\n[Provider: ${provider?.name}]\n\n${message}`, + role: 'user', }); } else if (type === 'link' && typeof href === 'string') { try { diff --git a/app/components/chat/Messages.client.tsx b/app/components/chat/Messages.client.tsx index 6dc8d7f3..f33def39 100644 --- a/app/components/chat/Messages.client.tsx +++ b/app/components/chat/Messages.client.tsx @@ -11,6 +11,7 @@ import { useStore } from '@nanostores/react'; import { profileStore } from '~/lib/stores/profile'; import { forwardRef } from 'react'; import type { ForwardedRef } from 'react'; +import type { ProviderInfo } from '~/types/model'; interface MessagesProps { id?: string; @@ -20,6 +21,8 @@ interface MessagesProps { append?: (message: Message) => void; chatMode?: 'discuss' | 'build'; setChatMode?: (mode: 'discuss' | 'build') => void; + model?: string; + provider?: ProviderInfo; } export const Messages = forwardRef( @@ -100,6 +103,8 @@ export const Messages = forwardRef( append={props.append} chatMode={props.chatMode} setChatMode={props.setChatMode} + model={props.model} + provider={props.provider} /> )}