diff --git a/apps/rowboat/app/lib/agents.ts b/apps/rowboat/app/lib/agents.ts index 60b2ae09..35d5ca8c 100644 --- a/apps/rowboat/app/lib/agents.ts +++ b/apps/rowboat/app/lib/agents.ts @@ -743,21 +743,20 @@ function ensureSystemMessage(logger: PrefixLogger, messages: z.infer 0 && messages[0]?.role !== 'system') { + if (messages[0]?.role !== 'system') { messages.unshift({ role: 'system', - content: 'You are a helpful assistant.', + content: '', }); logger.log(`added system message: ${messages[0]?.content}`); } // ensure that system message isn't blank - if (messages.length > 0 && messages[0]?.role === 'system' && !messages[0].content) { + if (!messages[0].content) { const defaultContext = `You are a helpful assistant. Basic context: - - Today's date is ${new Date().toLocaleDateString()} - - Current time is ${new Date().toLocaleTimeString()}.`; + - The date-time right now is ${new Date().toISOString()}`; messages[0].content = defaultContext; logger.log(`updated system message with default context: ${messages[0].content}`); diff --git a/apps/rowboat/app/lib/types/types.ts b/apps/rowboat/app/lib/types/types.ts index dab9bdde..c03e9ffd 100644 --- a/apps/rowboat/app/lib/types/types.ts +++ b/apps/rowboat/app/lib/types/types.ts @@ -129,18 +129,6 @@ export const User = z.object({ updatedAt: z.string().datetime(), }); -export const PlaygroundChat = z.object({ - createdAt: z.string().datetime(), - projectId: z.string(), - title: z.string().optional(), - messages: z.array(Message), - simulated: z.boolean().default(false).optional(), - simulationScenario: z.string().optional(), - simulationComplete: z.boolean().default(false).optional(), - agenticState: z.unknown().optional(), - systemMessage: z.string().optional(), -}); - export const Webpage = z.object({ _id: z.string(), title: z.string(), diff --git a/apps/rowboat/app/projects/[projectId]/playground/app.tsx b/apps/rowboat/app/projects/[projectId]/playground/app.tsx index bb7491a3..369cf980 100644 --- a/apps/rowboat/app/projects/[projectId]/playground/app.tsx +++ b/apps/rowboat/app/projects/[projectId]/playground/app.tsx @@ -1,25 +1,19 @@ 'use client'; import { useState, useCallback, useRef } from "react"; import { z } from "zod"; -import { MCPServer, Message, PlaygroundChat } from "@/app/lib/types/types"; -import { Workflow, WorkflowTool } from "@/app/lib/types/workflow_types"; +import { Message } from "@/app/lib/types/types"; +import { Workflow } from "@/app/lib/types/workflow_types"; import { Chat } from "./components/chat"; import { Panel } from "@/components/common/panel-common"; import { Button } from "@/components/ui/button"; import { Tooltip } from "@heroui/react"; -import { WithStringId } from "@/app/lib/types/types"; -import { CheckIcon, CopyIcon, PlusIcon, UserIcon, InfoIcon, BugIcon, BugOffIcon, CodeIcon } from "lucide-react"; -import { clsx } from "clsx"; - -const defaultSystemMessage = ''; +import { CheckIcon, CopyIcon, PlusIcon, InfoIcon, BugIcon, BugOffIcon } from "lucide-react"; export function App({ hidden = false, projectId, workflow, messageSubscriber, - mcpServerUrls, - isInitialState = false, onPanelClick, triggerCopilotChat, }: { @@ -27,40 +21,16 @@ export function App({ projectId: string; workflow: z.infer; messageSubscriber?: (messages: z.infer[]) => void; - mcpServerUrls: Array>; - isInitialState?: boolean; onPanelClick?: () => void; triggerCopilotChat?: (message: string) => void; }) { const [counter, setCounter] = useState(0); - const [systemMessage, setSystemMessage] = useState(defaultSystemMessage); const [showDebugMessages, setShowDebugMessages] = useState(true); - const [chat, setChat] = useState>({ - projectId, - createdAt: new Date().toISOString(), - messages: [], - simulated: false, - systemMessage: defaultSystemMessage, - }); - const [isProfileSelectorOpen, setIsProfileSelectorOpen] = useState(false); const [showCopySuccess, setShowCopySuccess] = useState(false); const getCopyContentRef = useRef<(() => string) | null>(null); - function handleSystemMessageChange(message: string) { - setSystemMessage(message); - setCounter(counter + 1); - } - function handleNewChatButtonClick() { setCounter(counter + 1); - setChat({ - projectId, - createdAt: new Date().toISOString(), - messages: [], - simulated: false, - systemMessage: defaultSystemMessage, - }); - setSystemMessage(defaultSystemMessage); } const handleCopyJson = useCallback(() => { @@ -142,13 +112,9 @@ export function App({
{ getCopyContentRef.current = fn; }} showDebugMessages={showDebugMessages} triggerCopilotChat={triggerCopilotChat} diff --git a/apps/rowboat/app/projects/[projectId]/playground/components/chat.tsx b/apps/rowboat/app/projects/[projectId]/playground/components/chat.tsx index 473ef311..cd1de4aa 100644 --- a/apps/rowboat/app/projects/[projectId]/playground/components/chat.tsx +++ b/apps/rowboat/app/projects/[projectId]/playground/components/chat.tsx @@ -3,49 +3,39 @@ import { useEffect, useRef, useState, useCallback } from "react"; import { getAssistantResponseStreamId } from "@/app/actions/actions"; import { Messages } from "./messages"; import z from "zod"; -import { MCPServer, Message, PlaygroundChat, ToolMessage } from "@/app/lib/types/types"; -import { Workflow, WorkflowTool } from "@/app/lib/types/workflow_types"; +import { Message, ToolMessage } from "@/app/lib/types/types"; +import { Workflow } from "@/app/lib/types/workflow_types"; import { ComposeBoxPlayground } from "@/components/common/compose-box-playground"; import { Button } from "@heroui/react"; -import { WithStringId } from "@/app/lib/types/types"; -import { ProfileContextBox } from "./profile-context-box"; import { BillingUpgradeModal } from "@/components/common/billing-upgrade-modal"; import { ChevronDownIcon } from "@heroicons/react/24/outline"; import { FeedbackModal } from "./feedback-modal"; import { FIX_WORKFLOW_PROMPT, FIX_WORKFLOW_PROMPT_WITH_FEEDBACK, EXPLAIN_WORKFLOW_PROMPT_ASSISTANT, EXPLAIN_WORKFLOW_PROMPT_TOOL, EXPLAIN_WORKFLOW_PROMPT_TRANSITION } from "../copilot-prompts"; export function Chat({ - chat, projectId, workflow, messageSubscriber, - systemMessage, - onSystemMessageChange, - mcpServerUrls, onCopyClick, showDebugMessages = true, showJsonMode = false, triggerCopilotChat, }: { - chat: z.infer; projectId: string; workflow: z.infer; messageSubscriber?: (messages: z.infer[]) => void; - systemMessage: string; - onSystemMessageChange: (message: string) => void; - mcpServerUrls: Array>; onCopyClick: (fn: () => string) => void; showDebugMessages?: boolean; showJsonMode?: boolean; triggerCopilotChat?: (message: string) => void; }) { - const [messages, setMessages] = useState[]>(chat.messages); + const [messages, setMessages] = useState[]>([]); const [loadingAssistantResponse, setLoadingAssistantResponse] = useState(false); const [fetchResponseError, setFetchResponseError] = useState(null); const [billingError, setBillingError] = useState(null); const [lastAgenticRequest, setLastAgenticRequest] = useState(null); const [lastAgenticResponse, setLastAgenticResponse] = useState(null); - const [optimisticMessages, setOptimisticMessages] = useState[]>(chat.messages); + const [optimisticMessages, setOptimisticMessages] = useState[]>([]); const [isLastInteracted, setIsLastInteracted] = useState(false); const [showFeedbackModal, setShowFeedbackModal] = useState(false); const [pendingFixMessage, setPendingFixMessage] = useState(null); @@ -82,14 +72,11 @@ export function Chat({ const getCopyContent = useCallback(() => { return JSON.stringify({ - messages: [{ - role: 'system', - content: systemMessage, - }, ...messages], + messages, lastRequest: lastAgenticRequest, lastResponse: lastAgenticResponse, }, null, 2); - }, [messages, systemMessage, lastAgenticRequest, lastAgenticResponse]); + }, [messages, lastAgenticRequest, lastAgenticResponse]); // Expose copy function to parent useEffect(() => { @@ -206,13 +193,7 @@ export function Chat({ const response = await getAssistantResponseStreamId( projectId, workflow, - [ - { - role: 'system', - content: systemMessage || '', - }, - ...messages, - ], + messages, ); if (ignore) { return; @@ -329,8 +310,6 @@ export function Chat({ messages, projectId, workflow, - systemMessage, - mcpServerUrls, fetchResponseError, ]); @@ -362,9 +341,6 @@ export function Chat({ toolCallResults={toolCallResults} loadingAssistantResponse={loadingAssistantResponse} workflow={workflow} - systemMessage={systemMessage} - onSystemMessageChange={onSystemMessageChange} - showSystemMessage={false} showDebugMessages={showDebugMessages} showJsonMode={showJsonMode} onFix={handleFix} diff --git a/apps/rowboat/app/projects/[projectId]/playground/components/messages.tsx b/apps/rowboat/app/projects/[projectId]/playground/components/messages.tsx index bcbedef4..b0c576ae 100644 --- a/apps/rowboat/app/projects/[projectId]/playground/components/messages.tsx +++ b/apps/rowboat/app/projects/[projectId]/playground/components/messages.tsx @@ -212,7 +212,6 @@ function ToolCalls({ messages, sender, workflow, - systemMessage, delta, onFix, onExplain, @@ -226,7 +225,6 @@ function ToolCalls({ messages: z.infer[]; sender: string | null | undefined; workflow: z.infer; - systemMessage: string | undefined; delta: number; onFix?: (message: string, index: number) => void; onExplain?: (type: 'tool' | 'transition', message: string, index: number) => void; @@ -672,9 +670,6 @@ export function Messages({ toolCallResults, loadingAssistantResponse, workflow, - systemMessage, - onSystemMessageChange, - showSystemMessage, showDebugMessages = true, showJsonMode = false, onFix, @@ -685,9 +680,6 @@ export function Messages({ toolCallResults: Record>; loadingAssistantResponse: boolean; workflow: z.infer; - systemMessage: string | undefined; - onSystemMessageChange: (message: string) => void; - showSystemMessage: boolean; showDebugMessages?: boolean; showJsonMode?: boolean; onFix?: (message: string, index: number) => void; @@ -726,7 +718,6 @@ export function Messages({ messages={messages} sender={message.agentName ?? ''} workflow={workflow} - systemMessage={systemMessage} delta={latency} onFix={onFix} onExplain={onExplain} @@ -792,15 +783,6 @@ export function Messages({ return message.role === 'assistant' && (!('toolCalls' in message) || !Array.isArray(message.toolCalls) || !message.toolCalls.some(tc => tc.function.name.startsWith('transfer_to_'))); }; - if (showSystemMessage) { - return ( - - ); - } - // Just render the messages, no scroll container or unread bubble return (
diff --git a/apps/rowboat/app/projects/[projectId]/workflow/workflow_editor.tsx b/apps/rowboat/app/projects/[projectId]/workflow/workflow_editor.tsx index 8beb38ec..5039c337 100644 --- a/apps/rowboat/app/projects/[projectId]/workflow/workflow_editor.tsx +++ b/apps/rowboat/app/projects/[projectId]/workflow/workflow_editor.tsx @@ -1158,8 +1158,6 @@ export function WorkflowEditor({ projectId={projectId} workflow={state.present.workflow} messageSubscriber={updateChatMessages} - mcpServerUrls={mcpServerUrls} - isInitialState={isInitialState} onPanelClick={handlePlaygroundClick} triggerCopilotChat={triggerCopilotChat} />