manuscript reference as a tool

This commit is contained in:
2026-03-03 10:55:41 +10:00
parent d15b134d43
commit cc00c40214
7 changed files with 70 additions and 63 deletions

View File

@@ -42,10 +42,6 @@ export function ChatPanel(): JSX.Element {
setActiveSession,
rightPanelTab,
setRightPanelTab,
wholeStoryMode,
setWholeStoryMode,
storyBibleMode,
setStoryBibleMode,
} = useEditorStore()
const tab = rightPanelTab
@@ -89,9 +85,7 @@ export function ChatPanel(): JSX.Element {
.slice(-10)
.map((m) => ({ role: m.role, content: m.content })),
userMessage: text,
attachments: attachments.length > 0 ? attachments : undefined,
projectMode: wholeStoryMode,
storyBibleMode: storyBibleMode
attachments: attachments.length > 0 ? attachments : undefined
},
(chunk: string) => {
appendToLastAssistantMessage(chunk)
@@ -164,25 +158,6 @@ export function ChatPanel(): JSX.Element {
</button>
</div>
{/* ── Context toggles: Story bible + Whole story ── */}
{tab === 'chat' && hasFile && (
<div className="chat-context-bar">
<button
className={`chat-project-toggle${storyBibleMode ? ' chat-project-toggle--active' : ''}`}
onClick={() => setStoryBibleMode(!storyBibleMode)}
title={storyBibleMode ? 'Story bible on — Claude sees your reference notes' : 'Enable story bible context'}
>
{storyBibleMode ? '◉' : '○'} Story bible
</button>
<button
className={`chat-project-toggle${wholeStoryMode ? ' chat-project-toggle--active' : ''}`}
onClick={() => setWholeStoryMode(!wholeStoryMode)}
title={wholeStoryMode ? 'Whole story on — Claude sees all chapters' : 'Enable whole story context'}
>
{wholeStoryMode ? '◉' : '○'} Whole story
</button>
</div>
)}
{/* ── Chat sub-header: History link + New Chat button ── */}
{showSubheader && (

View File

@@ -4,13 +4,12 @@ import { FileTreeNode } from './FileTreeNode'
import './FileTree.css'
export function FileTree(): JSX.Element {
const { fileTree, activeFilePath, setActiveFile, markSaved, setStoryBibleMode } = useEditorStore()
const { fileTree, activeFilePath, setActiveFile, markSaved } = useEditorStore()
const handleOpenStoryBible = async (): Promise<void> => {
try {
const { path, content } = await window.api.openStoryBible()
setActiveFile(path, content)
setStoryBibleMode(true)
// If the path didn't change (already on Story Bible), the MarkdownEditor's
// activeFilePath-keyed effect won't fire. Push content directly, same
// pattern as RevisionPanel.restore().

View File

@@ -71,14 +71,6 @@ interface EditorState {
theme: 'dark' | 'light'
toggleTheme: () => void
// Whole story context mode
wholeStoryMode: boolean
setWholeStoryMode: (enabled: boolean) => void
// Story bible context mode
storyBibleMode: boolean
setStoryBibleMode: (enabled: boolean) => void
// Revision panel
revisionPanelOpen: boolean
toggleRevisionPanel: () => void
@@ -550,18 +542,6 @@ export const useEditorStore = create<EditorState>((set, get) => ({
})
},
wholeStoryMode: localStorage.getItem('wholeStoryMode') === 'true',
setWholeStoryMode: (enabled: boolean) => {
localStorage.setItem('wholeStoryMode', String(enabled))
set({ wholeStoryMode: enabled })
},
storyBibleMode: localStorage.getItem('storyBibleMode') === 'true',
setStoryBibleMode: (enabled: boolean) => {
localStorage.setItem('storyBibleMode', String(enabled))
set({ storyBibleMode: enabled })
},
loadSession: async () => {
const api = (window as unknown as { api?: { readSession: () => Promise<Record<string, unknown>>; readFile: (p: string) => Promise<string> } }).api
if (!api) return

View File

@@ -57,8 +57,6 @@ export interface AIPayload {
conversationHistory: Array<{ role: 'user' | 'assistant'; content: string }>
userMessage: string
attachments?: Attachment[] // full data for current API call only
projectMode?: boolean // when true, main process injects all draft files as context
storyBibleMode?: boolean // when true, main process injects Story Bible.md as context
}
export interface RevisionMeta {