Hybrid approach: reuse LocalChunker to chunk the DoclingDocument JSON returned by Serve, so chunking works identically in both local and remote modes without calling Serve's chunk endpoint. Backend: - _build_chunker() always returns LocalChunker (remove engine guard) - Use docling-core[chunking] extra for required dependencies - Skip client-side batching in remote mode (Serve manages its own resources, and batching discards document_json needed for chunking) - Fix Serve form fields: remove generate_page_images (not a Serve field), use repeated form keys for to_formats and page_range - Log Serve error response body on 4xx/5xx for diagnosis - Fix FastAPI 204 DELETE routes missing response_model=None Frontend: - Update chunking feature flag to enable Prepare UI in remote mode Closes #51
28 lines
820 B
TypeScript
28 lines
820 B
TypeScript
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
import { setActivePinia, createPinia } from 'pinia'
|
|
import { useFeatureFlag } from './useFeatureFlag'
|
|
import { useFeatureFlagStore } from './store'
|
|
|
|
vi.mock('@/shared/api/http', () => ({ apiFetch: vi.fn() }))
|
|
|
|
describe('useFeatureFlag', () => {
|
|
beforeEach(() => {
|
|
setActivePinia(createPinia())
|
|
})
|
|
|
|
it('returns false before flags are loaded', () => {
|
|
const flag = useFeatureFlag('chunking')
|
|
expect(flag.value).toBe(false)
|
|
})
|
|
|
|
it('returns reactive value matching store state', () => {
|
|
const store = useFeatureFlagStore()
|
|
store.$patch({ loaded: true, engine: 'local' })
|
|
|
|
const flag = useFeatureFlag('chunking')
|
|
expect(flag.value).toBe(true)
|
|
|
|
store.$patch({ engine: 'remote' })
|
|
expect(flag.value).toBe(true)
|
|
})
|
|
})
|