diff --git a/src/api/modelConfig.ts b/src/api/modelConfig.ts new file mode 100644 index 0000000..39e955e --- /dev/null +++ b/src/api/modelConfig.ts @@ -0,0 +1,17 @@ +import { http } from "@/api/http"; +import type { ApiResponse } from "@/types/api"; +import type { + ModelWeightConfig, + ModelWeightConfigUpdate, +} from "@/types/modelConfig"; + +export function fetchModelConfig() { + return http.get>("/v1/model-config"); +} + +export function updateModelConfig(payload: ModelWeightConfigUpdate) { + return http.patch>( + "/v1/model-config", + payload, + ); +} diff --git a/src/api/ocr.ts b/src/api/ocr.ts new file mode 100644 index 0000000..24f0866 --- /dev/null +++ b/src/api/ocr.ts @@ -0,0 +1,31 @@ +import { http } from "@/api/http"; +import type { ApiResponse } from "@/types/api"; +import type { + OcrBatchResult, + OcrMeasurement, + OcrStandardJudgment, +} from "@/types/ocr"; + +export function recognizeOcrFiles(files: File[]) { + const body = new FormData(); + files.forEach((file) => body.append("files", file)); + return http.post>("/v1/ocr/recognize", body, { + timeout: 180_000, + }); +} + +export function judgeOcrMeasurements(measurements: OcrMeasurement[]) { + return http.post>("/v1/ocr/judge", { + measurements, + }); +} + +export function ocrFileUrl(fileId: string) { + return `${import.meta.env.VITE_API_BASE_URL || "/api"}/v1/ocr/files/${encodeURIComponent(fileId)}`; +} + +export function downloadOcrFile(fileId: string) { + return http.get(`/v1/ocr/files/${encodeURIComponent(fileId)}`, { + responseType: "blob", + }); +} diff --git a/src/components/assistant/AssistantComposer.vue b/src/components/assistant/AssistantComposer.vue index 3244fad..1b4edbc 100644 --- a/src/components/assistant/AssistantComposer.vue +++ b/src/components/assistant/AssistantComposer.vue @@ -11,7 +11,9 @@ import { Search, } from "@lucide/vue"; -defineProps<{ modelValue: string; loading: boolean }>(); +import { featureFlags } from "@/config/features"; + +defineProps<{ modelValue: string; loading: boolean; canUpload: boolean }>(); const emit = defineEmits<{ "update:modelValue": [value: string]; @@ -93,6 +95,7 @@ const functions: Array<{