mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-12 09:12:40 +02:00
feat(filesystem): propagate localRootPaths across desktop and web API
This commit is contained in:
parent
6721919398
commit
3ee2683391
6 changed files with 93 additions and 30 deletions
|
|
@ -660,7 +660,7 @@ export default function NewChatPage() {
|
|||
const selection = await getAgentFilesystemSelection();
|
||||
if (
|
||||
selection.filesystem_mode === "desktop_local_folder" &&
|
||||
!selection.local_filesystem_root
|
||||
(!selection.local_filesystem_roots || selection.local_filesystem_roots.length === 0)
|
||||
) {
|
||||
toast.error("Select a local folder before using Local Folder mode.");
|
||||
return;
|
||||
|
|
@ -702,7 +702,7 @@ export default function NewChatPage() {
|
|||
search_space_id: searchSpaceId,
|
||||
filesystem_mode: selection.filesystem_mode,
|
||||
client_platform: selection.client_platform,
|
||||
local_filesystem_root: selection.local_filesystem_root,
|
||||
local_filesystem_roots: selection.local_filesystem_roots,
|
||||
messages: messageHistory,
|
||||
mentioned_document_ids: hasDocumentIds ? mentionedDocumentIds.document_ids : undefined,
|
||||
mentioned_surfsense_doc_ids: hasSurfsenseDocIds
|
||||
|
|
@ -1098,7 +1098,7 @@ export default function NewChatPage() {
|
|||
decisions,
|
||||
filesystem_mode: selection.filesystem_mode,
|
||||
client_platform: selection.client_platform,
|
||||
local_filesystem_root: selection.local_filesystem_root,
|
||||
local_filesystem_roots: selection.local_filesystem_roots,
|
||||
}),
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
|
@ -1435,7 +1435,7 @@ export default function NewChatPage() {
|
|||
disabled_tools: disabledTools.length > 0 ? disabledTools : undefined,
|
||||
filesystem_mode: selection.filesystem_mode,
|
||||
client_platform: selection.client_platform,
|
||||
local_filesystem_root: selection.local_filesystem_root,
|
||||
local_filesystem_roots: selection.local_filesystem_roots,
|
||||
}),
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ export type ClientPlatform = "web" | "desktop";
|
|||
export interface AgentFilesystemSelection {
|
||||
filesystem_mode: AgentFilesystemMode;
|
||||
client_platform: ClientPlatform;
|
||||
local_filesystem_root?: string;
|
||||
local_filesystem_roots?: string[];
|
||||
}
|
||||
|
||||
const DEFAULT_SELECTION: AgentFilesystemSelection = {
|
||||
|
|
@ -24,11 +24,12 @@ export async function getAgentFilesystemSelection(): Promise<AgentFilesystemSele
|
|||
}
|
||||
try {
|
||||
const settings = await window.electronAPI.getAgentFilesystemSettings();
|
||||
if (settings.mode === "desktop_local_folder" && settings.localRootPath) {
|
||||
const firstLocalRootPath = settings.localRootPaths[0];
|
||||
if (settings.mode === "desktop_local_folder" && firstLocalRootPath) {
|
||||
return {
|
||||
filesystem_mode: "desktop_local_folder",
|
||||
client_platform: "desktop",
|
||||
local_filesystem_root: settings.localRootPath,
|
||||
local_filesystem_roots: settings.localRootPaths,
|
||||
};
|
||||
}
|
||||
return {
|
||||
|
|
|
|||
4
surfsense_web/types/window.d.ts
vendored
4
surfsense_web/types/window.d.ts
vendored
|
|
@ -45,7 +45,7 @@ type AgentFilesystemMode = "cloud" | "desktop_local_folder";
|
|||
|
||||
interface AgentFilesystemSettings {
|
||||
mode: AgentFilesystemMode;
|
||||
localRootPath: string | null;
|
||||
localRootPaths: string[];
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ interface ElectronAPI {
|
|||
getAgentFilesystemSettings: () => Promise<AgentFilesystemSettings>;
|
||||
setAgentFilesystemSettings: (settings: {
|
||||
mode?: AgentFilesystemMode;
|
||||
localRootPath?: string | null;
|
||||
localRootPaths?: string[] | null;
|
||||
}) => Promise<AgentFilesystemSettings>;
|
||||
pickAgentFilesystemRoot: () => Promise<string | null>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue