diff --git a/src/components/SasquatchGuide.tsx b/src/components/SasquatchGuide.tsx index 0caf217..234a798 100644 --- a/src/components/SasquatchGuide.tsx +++ b/src/components/SasquatchGuide.tsx @@ -225,9 +225,14 @@ export function SasquatchGuide({ message, onDismiss }: SasquatchGuideProps) { let accumulated = ''; // First pass: get AI response which may include a TOOL: call + // Inject system prompt as first user message if system role unsupported + const messagesWithSystem = [ + { role: 'system' as const, content: SYSTEM_PROMPT }, + ...history, + ]; const firstResponse = await shakespeare.sendChatMessage( - [{ role: 'system', content: SYSTEM_PROMPT }, ...history], - 'shakespeare/claude-sonnet-4-5' + messagesWithSystem, + 'shakespeare' ); const aiText = firstResponse.choices[0]?.message?.content as string ?? ''; @@ -273,14 +278,14 @@ export function SasquatchGuide({ message, onDismiss }: SasquatchGuideProps) { setStreamingText(''); const toolResultStr = JSON.stringify(toolResult, null, 2); const secondResponse = await shakespeare.sendChatMessage([ - { role: 'system', content: SYSTEM_PROMPT }, + { role: 'system' as const, content: SYSTEM_PROMPT }, ...history, - { role: 'assistant', content: aiText }, + { role: 'assistant' as const, content: aiText }, { - role: 'user', - content: `Tool result from ${toolName}:\n${toolResultStr}\n\nNow answer the user's question naturally based on this live data.`, + role: 'user' as const, + content: `Tool result from ${toolName}:\n${toolResultStr}\n\nNow answer the user's question naturally based on this live data. Be concise and skater-friendly.`, }, - ], 'shakespeare/claude-sonnet-4-5'); + ], 'shakespeare'); accumulated = secondResponse.choices[0]?.message?.content as string ?? ''; } catch (toolErr) {