feat: add HoloLake folder import and official assistant

This commit is contained in:
冰朔 2026-08-08 11:15:34 +08:00
commit a360982a9b
12 changed files with 507 additions and 76 deletions

View file

@ -17,6 +17,7 @@ import { app, BrowserWindow, shell, dialog, ipcMain, safeStorage } from 'electro
import path from 'path';
import { spawn, ChildProcess } from 'child_process';
import fs from 'fs';
import { importKnowledgeFolder } from './folder-import.js';
// ─── 配置 ───
@ -130,7 +131,7 @@ function createWindow(): void {
minHeight: 600,
titleBarStyle: 'hiddenInset',
trafficLightPosition: { x: 16, y: 16 },
backgroundColor: '#0d1117',
backgroundColor: '#f7f8fb',
webPreferences: {
preload: path.join(__dirname, 'preload.cjs'),
contextIsolation: true,
@ -157,6 +158,17 @@ function createWindow(): void {
}
ipcMain.handle('get-data-path', () => DATA_DIR);
ipcMain.handle('knowledge:import-folder', async () => {
const selection = await dialog.showOpenDialog(mainWindow ?? undefined, {
title: '导入本地知识文件夹',
buttonLabel: '导入到 HoloLake',
properties: ['openDirectory'],
});
if (selection.canceled || !selection.filePaths[0]) {
return { cancelled: true, imported: 0, assets: 0, skipped: 0, failed: [] };
}
return importKnowledgeFolder(selection.filePaths[0], KB_REPO_PATH);
});
ipcMain.handle('agent:get-config', () => {
const config = readModelConfig();
return {