feat(code): add Esc to exit code mode, project indicator pill, design token context
- Escape key exits code mode on desktop (T14) - Show active project name pill near chat input when in code mode (T15) - Inject selected design tokens, files, and open file content into AI system prompt when in code mode (T16) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
decee9163b
commit
ba0320fa8d
@@ -6,6 +6,7 @@ import type { ImageAttachment } from '@aiui/core/types/message'
|
||||
import { usePersonaStore } from '@/stores/personas'
|
||||
import { useMemoryStore } from '@/stores/memory'
|
||||
import { useArchy } from '@/composables/useArchy'
|
||||
import { useCodeContext } from '@/composables/useCodeContext'
|
||||
|
||||
type Provider = 'claude' | 'openrouter' | 'mock'
|
||||
|
||||
@@ -350,6 +351,28 @@ function buildSystemPrompt(chatStore: ReturnType<typeof useChatStore>): string {
|
||||
const archy = useArchy()
|
||||
prompt += archy.buildArchyContext()
|
||||
|
||||
// Append code context when in code mode
|
||||
const code = useCodeContext()
|
||||
if (code.isCodeMode.value) {
|
||||
const sections: string[] = []
|
||||
if (code.activeProject.value) {
|
||||
sections.push(`**Active project:** ${code.activeProject.value.name} (${code.activeProject.value.language ?? 'Unknown'})`)
|
||||
}
|
||||
if (code.selectedDesignTokens.value.length > 0) {
|
||||
sections.push(`**Selected design tokens:** ${code.selectedDesignTokens.value.join(', ')}`)
|
||||
}
|
||||
if (code.selectedFiles.value.length > 0) {
|
||||
sections.push(`**Selected files:** ${code.selectedFiles.value.join(', ')}`)
|
||||
}
|
||||
if (code.activeFileContent.value && code.activeFile.value) {
|
||||
const content = code.activeFileContent.value.slice(0, 2000)
|
||||
sections.push(`**Open file (${code.activeFile.value}):**\n\`\`\`${code.activeFileLanguage.value}\n${content}\n\`\`\``)
|
||||
}
|
||||
if (sections.length > 0) {
|
||||
prompt += `\n\n**Code Context:**\n${sections.join('\n')}`
|
||||
}
|
||||
}
|
||||
|
||||
return prompt
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user