@brainpilot/web 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index-DkoqxJfs.css +1 -0
- package/dist/assets/index-DtLW483q.js +451 -0
- package/dist/index.html +2 -2
- package/package.json +2 -2
- package/src/__tests__/messageGroups.test.ts +150 -0
- package/src/__tests__/newUiEvents.test.ts +32 -0
- package/src/components/chat/MessageStream.tsx +102 -32
- package/src/components/chat/PromptComposer.tsx +1 -0
- package/src/components/demo/DemoView.tsx +1 -1
- package/src/components/session/AgentTraceViews.tsx +5 -9
- package/src/components/settings/KnowledgeBasePanel.tsx +307 -143
- package/src/components/settings/SettingsDialog.tsx +115 -57
- package/src/components/shell/SandboxStatus.tsx +128 -84
- package/src/contexts/messageGroups.ts +110 -4
- package/src/contexts/messageReducer.ts +11 -1
- package/src/i18n/messages/chat.ts +10 -0
- package/src/i18n/messages/sandbox.ts +3 -0
- package/src/i18n/messages/settings.ts +40 -4
- package/src/i18n/messages/trace.ts +0 -2
- package/src/styles/global.css +821 -69
- package/src/utils/api.ts +63 -0
- package/dist/assets/index-D63mUJxx.js +0 -450
- package/dist/assets/index-D8J9Cnup.css +0 -1
package/src/utils/api.ts
CHANGED
|
@@ -790,6 +790,7 @@ export const api = {
|
|
|
790
790
|
ocrLimit?: number;
|
|
791
791
|
skip?: Array<"ocr" | "extract" | "chunk" | "vectorize">;
|
|
792
792
|
only?: Array<"ocr" | "extract" | "chunk" | "vectorize">;
|
|
793
|
+
hfMirror?: string;
|
|
793
794
|
}): Promise<{ ok: boolean; startedAt?: number; error?: string }> {
|
|
794
795
|
const res = await apiFetch(`${API_BASE}/kb/build`, {
|
|
795
796
|
method: "POST",
|
|
@@ -853,6 +854,68 @@ export const api = {
|
|
|
853
854
|
return handleJson(res);
|
|
854
855
|
},
|
|
855
856
|
|
|
857
|
+
// Download bge-m3 + bge-reranker-v2-m3 model weights (~2.5 GB) via
|
|
858
|
+
// `scripts/setup_models.py`. Independent slot from setupEnv — the two
|
|
859
|
+
// can run concurrently, and setupFull() chains them.
|
|
860
|
+
async setupModels(opts: {
|
|
861
|
+
hfMirror?: string;
|
|
862
|
+
kbRoot?: string;
|
|
863
|
+
} = {}): Promise<{ ok: boolean; startedAt?: number; error?: string }> {
|
|
864
|
+
const res = await apiFetch(`${API_BASE}/kb/setup-models`, {
|
|
865
|
+
method: "POST",
|
|
866
|
+
headers: { "content-type": "application/json" },
|
|
867
|
+
body: JSON.stringify(opts),
|
|
868
|
+
});
|
|
869
|
+
if (!res.ok) {
|
|
870
|
+
const body = await res.json().catch(() => ({}));
|
|
871
|
+
return { ok: false, error: body.error || `setup-models failed (${res.status})` };
|
|
872
|
+
}
|
|
873
|
+
return handleJson(res);
|
|
874
|
+
},
|
|
875
|
+
|
|
876
|
+
// One-click orchestration: create venv, then download models when venv
|
|
877
|
+
// exits 0. Preferred entry point from the KB panel — one button, two
|
|
878
|
+
// progress rows in the UI.
|
|
879
|
+
async setupFull(opts: {
|
|
880
|
+
python?: string;
|
|
881
|
+
reinstall?: boolean;
|
|
882
|
+
hfMirror?: string;
|
|
883
|
+
kbRoot?: string;
|
|
884
|
+
} = {}): Promise<{ ok: boolean; startedAt?: number; error?: string }> {
|
|
885
|
+
const res = await apiFetch(`${API_BASE}/kb/setup-full`, {
|
|
886
|
+
method: "POST",
|
|
887
|
+
headers: { "content-type": "application/json" },
|
|
888
|
+
body: JSON.stringify(opts),
|
|
889
|
+
});
|
|
890
|
+
if (!res.ok) {
|
|
891
|
+
const body = await res.json().catch(() => ({}));
|
|
892
|
+
return { ok: false, error: body.error || `setup-full failed (${res.status})` };
|
|
893
|
+
}
|
|
894
|
+
return handleJson(res);
|
|
895
|
+
},
|
|
896
|
+
|
|
897
|
+
// Persisted KB API config (SiliconFlow OCR key today). Backend never
|
|
898
|
+
// returns the plaintext — only a masked preview + boolean — so the
|
|
899
|
+
// browser can indicate "already saved" without ever holding the secret.
|
|
900
|
+
async getApiConfig(): Promise<{ hasOcrApiKey: boolean; ocrApiKeyPreview: string }> {
|
|
901
|
+
const res = await apiFetch(`${API_BASE}/kb/api-config`);
|
|
902
|
+
if (!res.ok) return { hasOcrApiKey: false, ocrApiKeyPreview: "" };
|
|
903
|
+
return handleJson(res);
|
|
904
|
+
},
|
|
905
|
+
|
|
906
|
+
async saveApiConfig(patch: { ocrApiKey?: string }): Promise<{ ok: boolean; error?: string }> {
|
|
907
|
+
const res = await apiFetch(`${API_BASE}/kb/api-config`, {
|
|
908
|
+
method: "PUT",
|
|
909
|
+
headers: { "content-type": "application/json" },
|
|
910
|
+
body: JSON.stringify(patch),
|
|
911
|
+
});
|
|
912
|
+
if (!res.ok) {
|
|
913
|
+
const body = await res.json().catch(() => ({}));
|
|
914
|
+
return { ok: false, error: body.error || `save failed (${res.status})` };
|
|
915
|
+
}
|
|
916
|
+
return handleJson(res);
|
|
917
|
+
},
|
|
918
|
+
|
|
856
919
|
eventsUrl(): string {
|
|
857
920
|
return `${API_BASE}/kb/events`;
|
|
858
921
|
},
|