Skip to content

World's first open-source enterprise world model.

A reader has a card and an origin has a label (#722)

WaylandYangbb56469454cb
diff --git a/web/src/api.ts b/web/src/api.ts
index a69ce2e3..98547f31 100644
--- a/web/src/api.ts
+++ b/web/src/api.ts
@@ -262,6 +262,12 @@ export interface LlmSettingsView {
embed_model?: string | null;
embed_dim?: number | null;
has_embed_key?: boolean;
+ ocr_base_url?: string | null;
+ ocr_backend?: string | null;
+ has_ocr_key?: boolean;
+ transcribe_base_url?: string | null;
+ transcribe_model?: string | null;
+ has_transcribe_key?: boolean;
}
export interface Member {
@@ -1001,6 +1007,10 @@ export interface Evidence {
stale: boolean;
/** 这条证据的文档已被删除;事实还活着是因为另有出处(#268) */
document_deleted: boolean;
+ /** 这块文字从哪来(0040);证明链那条路不带,缺席即原文 */
+ origin?: "stated" | "ocr" | "transcribed" | "described";
+ origin_model?: string | null;
+ anchor?: Record<string, unknown> | null;
}
export interface ChunkFull {
@@ -2367,7 +2377,27 @@ export const api = {
request<{
chat: { ok: boolean; reply?: string; error?: string };
embed: { ok: boolean; dim?: number; error?: string };
+ ocr?: { ok: boolean; version?: string | null; error?: string };
+ transcribe?: { ok: boolean; error?: string };
}>(`/api/v1/workspaces/${workspaceId}/settings/test`, { method: "POST" }),
+ /** 读扫描件的服务、转写模型各自一个保存:存它们不碰对话与嵌入那几列。
+ * `requeued`:因为缺它而等着的文件,这一存重新排进了处理队列几份 */
+ saveOcrSettings: (
+ workspaceId: string,
+ body: { base_url: string; api_key: string; backend: string },
+ ) =>
+ request<{ ok: boolean; requeued: number }>(
+ `/api/v1/workspaces/${workspaceId}/settings/ocr`,
+ { method: "PUT", body: JSON.stringify(body) },
+ ),
+ saveTranscribeSettings: (
+ workspaceId: string,
+ body: { base_url: string; api_key: string; model: string },
+ ) =>
+ request<{ ok: boolean; requeued: number }>(
+ `/api/v1/workspaces/${workspaceId}/settings/transcribe`,
+ { method: "PUT", body: JSON.stringify(body) },
+ ),
/** 是否配置了单点登录(0056)。四项环境变量缺一个都是 false——
* 登录页据此决定要不要露出那个按钮 */
diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts
index 77affc1b..bddf240f 100644
--- a/web/src/i18n/en.ts
+++ b/web/src/i18n/en.ts
@@ -247,7 +247,7 @@ export const en = {
},
"document.needs_reader": {
title: "A file needs a model to be read",
- hint: "Scans and images need a document-reading service, and recordings need a transcription model that labels speakers. Neither is configured on this deployment. The file is kept, and nothing was read from it.",
+ hint: "Scans and images need a document-reading service, and recordings need a transcription model that labels speakers. Each line says what was missing. The file is kept and nothing was read from it yet; it is read as soon as the reader is saved under Administration → Models.",
},
"governance.tripped": {
title: "The agent stopped deciding on its own",
@@ -991,6 +991,18 @@ export const en = {
play: "Play timeline",
pause: "Pause",
},
+ origin: {
+ ocr: (page: number | null) => (page === null ? "OCR" : `OCR · p. ${page}`),
+ transcribed: (span: string | null, speakers: string[]) =>
+ ["Transcribed", span, speakers.length > 0 ? speakers.join(", ") : null]
+ .filter(Boolean)
+ .join(" · "),
+ described: "Described by a model",
+ ocrHint: "Read from a scan or image. A character or digit may be misread.",
+ transcribedHint: "Transcribed from a recording. A name may be misheard.",
+ describedHint: "A model's description of an image. Nobody wrote or said these words.",
+ readBy: (model: string) => `Read by ${model}.`,
+ },
doc: {
backToLibrary: "← Back to Library",
sections: "sections",
@@ -1159,6 +1171,21 @@ export const en = {
ok: (reply: string) => `Reachable and authenticated (${reply})`,
okDim: (dim: number) => `Reachable and authenticated (dim ${dim})`,
unsaved: "Unsaved changes. Save this card to test them.",
+ readersTitle: "Reading scans and recordings",
+ readersIntro:
+ "Scanned PDFs, images and recordings have no text to parse, so each needs its own reader. They are set apart from chat so that sensitive files can stay on your own servers. A file that arrives before its reader waits, and the message center says so; saving the reader reads it.",
+ ocrService: "Document reading (OCR)",
+ ocrHint:
+ "A MinerU service (mineru-api). It reads each page's layout first, so every passage keeps its page and position.",
+ serviceUrl: "Service URL",
+ backend: "Backend (optional)",
+ transcribeModel: "Transcription",
+ transcribeHint:
+ "An OpenAI-compatible endpoint that labels speakers (diarized_json), such as gpt-4o-transcribe-diarize. A transcript that cannot say who spoke is not used.",
+ okVersion: (version: string) => `Reachable (MinerU ${version})`,
+ okReachable: "Reachable and authenticated",
+ savedRequeued: (n: number) =>
+ `Saved. ${n} waiting ${n === 1 ? "file is" : "files are"} being read.`,
},
ontology: {
title: "Ontology",
diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.ts
index bb76c523..0e2fcc9a 100644
--- a/web/src/i18n/zh.ts
+++ b/web/src/i18n/zh.ts
@@ -211,7 +211,7 @@ export const zh: Strings = {
},
"document.needs_reader": {
title: "有文件要靠模型才读得出来",
- hint: "扫描件和图片要配文档识别服务,录音要配能分出说话人的转写模型,这个部署都还没配。文件已经留着,但里面什么都没读出来。",
+ hint: "扫描件和图片要配文档识别服务,录音要配能分出说话人的转写模型;每一行写着缺的是什么。文件已经留着,还没读出任何内容;到「管理 > 模型」存好读取模型,就会自动读。",
},
"governance.tripped": {
title: "agent 停止自动裁决了",
@@ -885,6 +885,18 @@ export const zh: Strings = {
play: "播放时间线",
pause: "暂停",
},
+ origin: {
+ ocr: (page: number | null) => (page === null ? "OCR 识别" : `OCR 识别 · 第 ${page} 页`),
+ transcribed: (span: string | null, speakers: string[]) =>
+ ["转写", span, speakers.length > 0 ? speakers.join("、") : null]
+ .filter(Boolean)
+ .join(" · "),
+ described: "模型描述",
+ ocrHint: "从扫描件或图片上识别出来的文字,个别字或数字可能认错。",
+ transcribedHint: "从录音转写出来的文字,人名可能听错。",
+ describedHint: "模型对一张图的描述,没有人这样写过或说过。",
+ readBy: (model: string) => `读取模型:${model}。`,
+ },
doc: {
backToLibrary: "← 返回文库",
sections: "段",
@@ -1038,6 +1050,19 @@ export const zh: Strings = {
ok: (reply: string) => `已连通,认证通过(${reply})`,
okDim: (dim: number) => `已连通,认证通过(维度 ${dim})`,
unsaved: "有未保存的修改。先保存这张卡,再测试。",
+ readersTitle: "读扫描件与录音",
+ readersIntro:
+ "扫描件、图片和录音没有可以直接解析的文字,各要一个读取模型。它们和对话模型分开配置,敏感文件可以留在自己的服务器上。读取模型配好之前传上来的文件会先等着,消息中心会提示;存好之后自动读。",
+ ocrService: "文档识别(OCR)",
+ ocrHint: "MinerU 服务(mineru-api)。先识别每页版面再认字,每段文字都记着所在的页和位置。",
+ serviceUrl: "服务地址",
+ backend: "后端(可选)",
+ transcribeModel: "录音转写",
+ transcribeHint:
+ "会标注说话人的 OpenAI 兼容转写接口(diarized_json),例如 gpt-4o-transcribe-diarize。分不出谁说的转写不会采用。",
+ okVersion: (version: string) => `已连通(MinerU ${version})`,
+ okReachable: "已连通,认证通过",
+ savedRequeued: (n: number) => `已保存。${n} 个等待中的文件开始读取。`,
},
ontology: {
title: "本体",
diff --git a/web/src/origin.test.ts b/web/src/origin.test.ts
new file mode 100644
index 00000000..d6360df5
--- /dev/null
+++ b/web/src/origin.test.ts
@@ -0,0 +1,41 @@
+import { describe, expect, it } from "vitest";
+import { clock, originHint, originLabel } from "./origin";
+
+describe("originLabel", () => {
+ it("says nothing for words the file itself holds", () => {
+ expect(originLabel("stated", null)).toBeNull();
+ expect(originLabel(undefined, null)).toBeNull();
+ });
+
+ it("names the page a scan was read from", () => {
+ expect(originLabel("ocr", { page: 2, bbox: [1, 2, 3, 4] })).toBe("OCR · p. 2");
+ expect(originLabel("ocr", {})).toBe("OCR");
+ });
+
+ it("names the stretch of the recording and who spoke", () => {
+ expect(
+ originLabel("transcribed", { start_ms: 6400, end_ms: 9750, speaker: ["A", "B"] }),
+ ).toBe("Transcribed · 0:06–0:09 · A, B");
+ expect(originLabel("transcribed", { start_ms: 3_725_000, end_ms: 3_731_000, speaker: "A" })).toBe(
+ "Transcribed · 1:02:05–1:02:11 · A",
+ );
+ });
+
+ it("marks a description as one", () => {
+ expect(originLabel("described", {})).toBe("Described by a model");
+ });
+});
+
+describe("originHint", () => {
+ it("adds the model that read it", () => {
+ expect(originHint("ocr", "mineru 2.5.4 vlm-auto-engine")).toContain("mineru 2.5.4 vlm-auto-engine");
+ expect(originHint("stated", "x")).toBeUndefined();
+ });
+});
+
+describe("clock", () => {
+ it("pads minutes and seconds", () => {
+ expect(clock(0)).toBe("0:00");
+ expect(clock(65_000)).toBe("1:05");
+ });
+});
diff --git a/web/src/origin.ts b/web/src/origin.ts
new file mode 100644
index 00000000..dd7ec7f4
--- /dev/null
+++ b/web/src/origin.ts
@@ -0,0 +1,59 @@
+import { S } from "./i18n";
+
+/** 一块文字从哪来(0040)。原文是常态,常态不标;只有模型读出来、转写出来、描述出来的
+ * 那几种才在证据和文档里写一句——人据此知道这句话可能认错一个字、听错一个名字,
+ * 或者根本没有人这么写过 */
+export type Origin = "stated" | "ocr" | "transcribed" | "described";
+export type Anchor = Record<string, unknown> | null;
+
+const num = (v: unknown): number | null =>
+ typeof v === "number" && Number.isFinite(v) ? v : null;
+
+/** 毫秒写成录音里的钟点:一小时以内 m:ss,超过 h:mm:ss */
+export function clock(ms: number): string {
+ const total = Math.floor(ms / 1000);
+ const h = Math.floor(total / 3600);
+ const m = Math.floor((total % 3600) / 60);
+ const s = total % 60;
+ const pad = (n: number) => String(n).padStart(2, "0");
+ return h > 0 ? `${h}:${pad(m)}:${pad(s)}` : `${m}:${pad(s)}`;
+}
+
+/** 出处的一句短话:「OCR · p. 2」「Transcribed · 0:06–0:09 · A, B」。原文返回 null */
+export function originLabel(origin?: string | null, anchor?: Anchor): string | null {
+ switch (origin) {
+ case "ocr":
+ return S.origin.ocr(num(anchor?.page));
+ case "transcribed": {
+ const start = num(anchor?.start_ms);
+ const end = num(anchor?.end_ms);
+ const speakers = Array.isArray(anchor?.speaker)
+ ? anchor.speaker.filter((s): s is string => typeof s === "string")
+ : typeof anchor?.speaker === "string"
+ ? [anchor.speaker]
+ : [];
+ return S.origin.transcribed(
+ start !== null && end !== null ? `${clock(start)}–${clock(end)}` : null,
+ speakers,
+ );
+ }
+ case "described":
+ return S.origin.described;
+ default:
+ return null;
+ }
+}
+
+/** 悬停说明:这种出处要当心什么,以及是哪个模型读的 */
+export function originHint(origin?: string | null, model?: string | null): string | undefined {
+ const why =
+ origin === "ocr"
+ ? S.origin.ocrHint
+ : origin === "transcribed"
+ ? S.origin.transcribedHint
+ : origin === "described"
+ ? S.origin.describedHint
+ : null;
+ if (!why) return undefined;
+ return model ? `${why} ${S.origin.readBy(model)}` : why;
+}
diff --git a/web/src/pages/DocViewer.tsx b/web/src/pages/DocViewer.tsx
index 0cb5a7c9..964a82fe 100644
--- a/web/src/pages/DocViewer.tsx
+++ b/web/src/pages/DocViewer.tsx
@@ -4,6 +4,7 @@ import { Link, useNavigate, useParams, useSearch } from "@tanstack/react-router"
import { api, type ChunkFact } from "../api";
import { S } from "../i18n";
import { useKbId } from "../kb";
+import { originHint, originLabel } from "../origin";
import { GroupLabel, PageHeader, Pager, pageSlice } from "../ui";
import { SourcesRail } from "./SourcesRail";
@@ -111,6 +112,13 @@ export function DocViewer() {
>
<div className="mb-2 text-small text-ink-2">
{S.doc.section} {c.seq + 1}
+ {/* 认出来、转写出来的字标一句出处:可能认错一个数、听错一个名字 */}
+ {originLabel(c.origin, c.anchor) && (
+ <span title={originHint(c.origin, c.origin_model)}>
+ {" · "}
+ {originLabel(c.origin, c.anchor)}
+ </span>
+ )}
{hit && (
<span
className={`u-fade-slow ml-2 text-accent ${
diff --git a/web/src/pages/Graph.tsx b/web/src/pages/Graph.tsx
index 3e4e05f6..231dec20 100644
--- a/web/src/pages/Graph.tsx
+++ b/web/src/pages/Graph.tsx
@@ -95,6 +95,7 @@ import {
type BlockedDerivation,
type ProofStep,
} from "../api";
+import { originHint, originLabel } from "../origin";
import { S } from "../i18n";
import { predicateSentence } from "../predicateText";
import {
@@ -3473,6 +3474,15 @@ function EvidenceList({ kbId, fact }: { kbId: string; fact: EntityFact }) {
</span>
<ExternalLink size={11} className="shrink-0" />
</Link>
+ {/* 出处不是原文时写一句(0040):OCR 第几页、录音哪一段谁说的、模型描述 */}
+ {originLabel(ev.origin, ev.anchor) && (
+ <span
+ className="shrink-0 text-fine text-ink-2"
+ title={originHint(ev.origin, ev.origin_model)}
+ >
+ {originLabel(ev.origin, ev.anchor)}
+ </span>
+ )}
{ev.stale && (
<span
className="u-num shrink-0 text-fine text-ink-2"
diff --git a/web/src/pages/Settings.tsx b/web/src/pages/Settings.tsx
index 05f91bc2..fbe573b0 100644
--- a/web/src/pages/Settings.tsx
+++ b/web/src/pages/Settings.tsx
@@ -890,6 +890,12 @@ export function Settings() {
embed_base_url: "",
embed_api_key: "",
embed_model: "",
+ ocr_base_url: "",
+ ocr_api_key: "",
+ ocr_backend: "",
+ transcribe_base_url: "",
+ transcribe_api_key: "",
+ transcribe_model: "",
});
useEffect(() => {
@@ -900,6 +906,10 @@ export function Settings() {
chat_model: settings.data.chat_model ?? "",
embed_base_url: settings.data.embed_base_url ?? "",
embed_model: settings.data.embed_model ?? "",
+ ocr_base_url: settings.data.ocr_base_url ?? "",
+ ocr_backend: settings.data.ocr_backend ?? "",
+ transcribe_base_url: settings.data.transcribe_base_url ?? "",
+ transcribe_model: settings.data.transcribe_model ?? "",
}));
}
}, [settings.data]);
@@ -926,6 +936,38 @@ export function Settings() {
});
const saveChat = usePatch();
const saveEmbed = usePatch();
+ /* 读扫描件的服务、转写模型各有自己的接口:存它们不经过上面那份整体替换,
+ 所以不用 withSaved 垫底子。回来的 `requeued` 是因为缺它而等着的文件数 */
+ const saveOcr = useMutation({
+ mutationFn: () =>
+ api.saveOcrSettings(workspace!.id, {
+ base_url: form.ocr_base_url,
+ api_key: form.ocr_api_key,
+ backend: form.ocr_backend,
+ }),
+ onSuccess: () => {
+ setDirty((d) => ({ ...d, ocr: false }));
+ queryClient.invalidateQueries({ queryKey: ["settings", workspace?.id] });
+ },
+ });
+ const saveTranscribe = useMutation({
+ mutationFn: () =>
+ api.saveTranscribeSettings(workspace!.id, {
+ base_url: form.transcribe_base_url,
+ api_key: form.transcribe_api_key,
+ model: form.transcribe_model,
+ }),
+ onSuccess: () => {
+ setDirty((d) => ({ ...d, transcribe: false }));
+ queryClient.invalidateQueries({ queryKey: ["settings", workspace?.id] });
+ },
+ });
+ const resetSaves = () => {
+ saveChat.reset();
+ saveEmbed.reset();
+ saveOcr.reset();
+ saveTranscribe.reset();
+ };
const test = useMutation({
mutationFn: () => api.testSettings(workspace!.id),
@@ -934,15 +976,21 @@ export function Settings() {
});
/* 哪张卡按下的"测试"。测一次是两套一起测(一个接口),结果各自回卡;
但两个按钮共用这一个 mutation,从前按任意一张两张一起转"Testing…"(#698) */
- const [testCard, setTestCard] = useState<"chat" | "embed" | null>(null);
+ const [testCard, setTestCard] = useState<"chat" | "embed" | "ocr" | "transcribe" | null>(
+ null,
+ );
/* 两张卡各自有没有改过、还没保存的格子。测试只测已保存的配置,所以有修改的那张卡
不让测,备注改说「先保存」;保存成功才清掉(#698) */
- const [dirty, setDirty] = useState({ chat: false, embed: false });
+ const [dirty, setDirty] = useState({
+ chat: false,
+ embed: false,
+ ocr: false,
+ transcribe: false,
+ });
/* 开测:上一轮的结论(两边卡的 Saved/报错、上一轮测试结果)全部让位给这一轮 */
const startTest = () => {
test.reset();
- saveChat.reset();
- saveEmbed.reset();
+ resetSaves();
test.mutate();
};
@@ -954,9 +1002,9 @@ export function Settings() {
/* 改一格,旧结论全部过期:测试结果、Saved、报错说的都是改之前的那份配置(#698)。
测的永远是已存盘的那份,所以表单一动,卡上就不该再贴任何旧话 */
test.reset();
- saveChat.reset();
- saveEmbed.reset();
- setDirty((d) => ({ ...d, [k.startsWith("chat_") ? "chat" : "embed"]: true }));
+ resetSaves();
+ // 字段名的前缀就是卡:chat_ / embed_ / ocr_ / transcribe_
+ setDirty((d) => ({ ...d, [k.split("_")[0]]: true }));
setForm({ ...form, [k]: e.target.value });
};
@@ -997,7 +1045,39 @@ export function Settings() {
dirty: dirty.embed,
},
);
- /* 备注的画法两张卡共用:成功走 ok 色、失败走 danger 色——从前成功是中性 accent、
+ const ocrStatus = modelCardStatus(
+ test.data?.ocr
+ ? {
+ ok: test.data.ocr.ok,
+ message: test.data.ocr.ok
+ ? S.settings.okVersion(test.data.ocr.version ?? "?")
+ : (test.data.ocr.error ?? ""),
+ }
+ : null,
+ testTransportError,
+ {
+ error: saveOcr.error ? (saveOcr.error as Error).message : null,
+ saved: saveOcr.isSuccess,
+ dirty: dirty.ocr,
+ },
+ );
+ const transcribeStatus = modelCardStatus(
+ test.data?.transcribe
+ ? {
+ ok: test.data.transcribe.ok,
+ message: test.data.transcribe.ok
+ ? S.settings.okReachable
+ : (test.data.transcribe.error ?? ""),
+ }
+ : null,
+ testTransportError,
+ {
+ error: saveTranscribe.error ? (saveTranscribe.error as Error).message : null,
+ saved: saveTranscribe.isSuccess,
+ dirty: dirty.transcribe,
+ },
+ );
+ /* 备注的画法四张卡共用:成功走 ok 色、失败走 danger 色——从前成功是中性 accent、
嵌入卡的报错还是正文字色,与本页数据源那节的 ok/danger 不一致(#698) */
const cardNote = (s: ModelCardStatus) =>
s.kind === "idle" ? undefined : s.kind === "saved" ? (
@@ -1007,6 +1087,9 @@ export function Settings() {
) : (
<span className={s.tone}>{s.text}</span>
);
+ /* 读取模型那两张卡存完多说一句:等着它的文件开始读了几份 */
+ const readerNote = (s: ModelCardStatus, requeued: number | undefined) =>
+ s.kind === "saved" && requeued ? S.settings.savedRequeued(requeued) : cardNote(s);
return (
<div className="h-full overflow-y-auto u-scroll px-8 py-6">
@@ -1038,9 +1121,8 @@ export function Settings() {
onClick={() => {
/* 预设只是批量填格,和手输一样让旧结论过期 */
test.reset();
- saveChat.reset();
- saveEmbed.reset();
- setDirty({ chat: true, embed: true });
+ resetSaves();
+ setDirty((d) => ({ ...d, chat: true, embed: true }));
setForm({
...form,
chat_base_url: p.chat,
@@ -1201,6 +1283,144 @@ export function Settings() {
</div>
</div>
</SettingsCard>
+
+ {/* 读取模型:扫描件、图片、录音(0040)。跟上面两张分开讲,因为它们只在
+ 那几类文件上用得到,没配也不影响别的——文件等着,消息中心会说 */}
+ <h2 className="pt-4 text-title text-ink">{S.settings.readersTitle}</h2>
+ <p className="text-body text-ink-2">{S.settings.readersIntro}</p>
+
+ <SettingsCard
+ title={S.settings.ocrService}
+ hint={S.settings.ocrHint}
+ note={readerNote(ocrStatus, saveOcr.data?.requeued)}
+ action={
+ <>
+ <Button variant="secondary" size="sm"
+ onClick={() => {
+ setTestCard("ocr");
+ startTest();
+ }}
+ disabled={test.isPending || dirty.ocr}
+ >
+ {testCard === "ocr" && test.isPending ? S.settings.testing : S.settings.test}
+ </Button>
+ <Button variant="secondary" size="sm"
+ onClick={() => {
+ test.reset();
+ saveOcr.mutate();
+ }}
+ disabled={saveOcr.isPending}
+ >
+ {saveOcr.isPending ? S.settings.saving : S.settings.save}
+ </Button>
+ </>
+ }
+ >
+ <div className="space-y-3">
+ <div>
+ <label className={label}>{S.settings.serviceUrl}</label>
+ <Input
+ className="w-full"
+ placeholder="http://localhost:8000"
+ value={form.ocr_base_url}
+ onChange={set("ocr_base_url")}
+ />
+ </div>
+ <div className="grid grid-cols-2 gap-3">
+ <div>
+ <label className={label}>{S.settings.backend}</label>
+ <Input
+ className="w-full"
+ placeholder="vlm-auto-engine"
+ value={form.ocr_backend}
+ onChange={set("ocr_backend")}
+ />
+ </div>
+ <div>
+ <label className={label}>
+ {S.settings.apiKey}{" "}
+ {settings.data?.has_ocr_key && (
+ <span className="text-accent">{S.settings.keyConfigured}</span>
+ )}
+ </label>
+ <Input
+ className="w-full"
+ type="password"
+ value={form.ocr_api_key}
+ onChange={set("ocr_api_key")}
+ />
+ </div>
+ </div>
+ </div>
+ </SettingsCard>
+
+ <SettingsCard
+ title={S.settings.transcribeModel}
+ hint={S.settings.transcribeHint}
+ note={readerNote(transcribeStatus, saveTranscribe.data?.requeued)}
+ action={
+ <>
+ <Button variant="secondary" size="sm"
+ onClick={() => {
+ setTestCard("transcribe");
+ startTest();
+ }}
+ disabled={test.isPending || dirty.transcribe}
+ >
+ {testCard === "transcribe" && test.isPending
+ ? S.settings.testing
+ : S.settings.test}
+ </Button>
+ <Button variant="secondary" size="sm"
+ onClick={() => {
+ test.reset();
+ saveTranscribe.mutate();
+ }}
+ disabled={saveTranscribe.isPending}
+ >
+ {saveTranscribe.isPending ? S.settings.saving : S.settings.save}
+ </Button>
+ </>
+ }
+ >
+ <div className="space-y-3">
+ <div>
+ <label className={label}>{S.settings.baseUrl}</label>
+ <Input
+ className="w-full"
+ placeholder="https://api.openai.com/v1"
+ value={form.transcribe_base_url}
+ onChange={set("transcribe_base_url")}
+ />
+ </div>
+ <div className="grid grid-cols-2 gap-3">
+ <div>
+ <label className={label}>{S.settings.model}</label>
+ <Input
+ className="w-full"
+ placeholder="gpt-4o-transcribe-diarize"
+ value={form.transcribe_model}
+ onChange={set("transcribe_model")}
+ />
+ </div>
+ <div>
+ <label className={label}>
+ {S.settings.apiKey}{" "}
+ {settings.data?.has_transcribe_key && (
+ <span className="text-accent">{S.settings.keyConfigured}</span>
+ )}
+ </label>
+ <Input
+ className="w-full"
+ type="password"
+ placeholder="sk-…"
+ value={form.transcribe_api_key}
+ onChange={set("transcribe_api_key")}
+ />
+ </div>
+ </div>
+ </div>
+ </SettingsCard>
</div>
)}
</div>