upload attachments and custom feedback

This commit is contained in:
2026-02-26 04:50:54 +10:00
parent f9333626aa
commit ee09163a7d
15 changed files with 580 additions and 41 deletions

View File

@@ -5,10 +5,20 @@ export interface FileNode {
children?: FileNode[]
}
export interface AttachmentMeta {
name: string
mimeType: string
}
export interface Attachment extends AttachmentMeta {
data: string // base64 for images, extracted text for text/PDF
}
export interface ChatMessage {
id: string
role: 'user' | 'assistant'
content: string
attachments?: AttachmentMeta[] // metadata only — stored in history for display
}
export type AnnotationType = 'passive_voice' | 'consistency' | 'style' | 'critique'
@@ -33,6 +43,7 @@ export interface AIPayload {
documentPath: string
conversationHistory: Array<{ role: 'user' | 'assistant'; content: string }>
userMessage: string
attachments?: Attachment[] // full data for current API call only
}
export interface RevisionMeta {

View File

@@ -1,4 +1,4 @@
import type { FileNode, AIPayload, RevisionMeta } from './editor'
import type { FileNode, AIPayload, RevisionMeta, Attachment } from './editor'
declare global {
interface Window {
@@ -13,6 +13,7 @@ declare global {
removeAIListener: () => void
getProjectWordCount: () => Promise<number>
saveOrder: (order: Record<string, string[]>) => Promise<void>
pickAttachments: () => Promise<Attachment[]>
saveRevision: (filePath: string, content: string) => Promise<void>
listRevisions: (filePath: string) => Promise<RevisionMeta[]>
loadRevision: (filePath: string, revisionId: string) => Promise<string>