feat(editor): add image insertion with OCR support and size limit handling

Add image button with dropdown menu for uploading local images or inserting from URL.
Integrate VLM-based OCR to extract text context from images and include in AI suggestions.
Implement document size limits to disable AI when exceeding threshold.
Refactor copilot plugin with per-view runtime state and OCR context injection.
Add OCR cache utility for managing image metadata.
Add code splitting configuration for optimized bundle size.
This commit is contained in:
“ydy0615”
2026-02-14 18:28:37 +08:00
parent c64ff7be45
commit 64cfa58376
16 changed files with 1593 additions and 458 deletions
+36
View File
@@ -7,6 +7,42 @@ export default defineConfig({
host: true,
port: 5173
},
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (!id.includes('node_modules')) return
const modulePath = id.split('node_modules/')[1]
const segments = modulePath.split('/')
const packageName = segments[0].startsWith('@')
? `${segments[0]}/${segments[1]}`
: segments[0]
if (packageName.startsWith('@milkdown')) return 'milkdown'
if (packageName.startsWith('prosemirror')) return 'prosemirror'
if (packageName.startsWith('@codemirror')) {
const langMatch = modulePath.match(/@codemirror\/lang-([^/]+)/)
if (langMatch) return `cm-lang-${langMatch[1]}`
return `cm-${segments[1]}`
}
if (packageName === 'refractor') {
const langMatch = modulePath.match(/refractor\/lang\/([^./]+)/)
if (langMatch) return `refractor-lang-${langMatch[1]}`
return 'refractor-core'
}
if (packageName.startsWith('katex')) return 'katex'
if (packageName.startsWith('markdown-it')) return 'markdown'
if (packageName === 'vue' || packageName.startsWith('@vue')) return 'vue'
return `vendor-${packageName.replace('@', '').replace('/', '-')}`
}
}
}
},
optimizeDeps: {
include: [
'@milkdown/crepe',