Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ release
backend/context_files/

# Editor directories and files
.vscode/
.vscode/.debug.env
.idea
.DS_Store
*.suo
Expand Down
23 changes: 23 additions & 0 deletions .vscode/.debug.script.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { createRequire } from 'node:module'
import { spawn } from 'node:child_process'

const pkg = createRequire(import.meta.url)('../package.json')
const __dirname = path.dirname(fileURLToPath(import.meta.url))

// write .debug.env
const envContent = Object.entries(pkg.debug.env).map(([key, val]) => `${key}=${val}`)
fs.writeFileSync(path.join(__dirname, '.debug.env'), envContent.join('\n'))

// bootstrap
spawn(
// TODO: terminate `npm run dev` when Debug exits.
process.platform === 'win32' ? 'npm.cmd' : 'npm',
['run', 'dev'],
{
stdio: 'inherit',
env: Object.assign(process.env, { VSCODE_DEBUG: 'true' }),
},
)
13 changes: 13 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"mrmlnc.vscode-json5",
"ms-python.python",
"ms-python.debugpy",
// Linting / Formatting
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"bradlc.vscode-tailwindcss"
]
}
70 changes: 70 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"compounds": [
{
"name": "Debug App",
"preLaunchTask": "Before Debug",
"configurations": [
"Debug Main Process",
"Debug Renderer Process"
],
"presentation": {
"hidden": false,
"group": "",
"order": 1
},
"stopAll": true
}
],
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
},
"runtimeArgs": [
"--no-sandbox",
"--remote-debugging-port=9229",
"."
],
"envFile": "${workspaceFolder}/.vscode/.debug.env",
"console": "integratedTerminal"
},
{
"name": "Debug Renderer Process",
"port": 9229,
"request": "attach",
"type": "chrome",
"timeout": 60000,
"skipFiles": [
"<node_internals>/**",
"${workspaceRoot}/node_modules/**",
"${workspaceRoot}/dist-electron/**",
// Skip files in host(VITE_DEV_SERVER_URL)
"http://127.0.0.1:7777/**"
]
},
{
"name": "Debug Python Backend (Attach)",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}/backend",
"remoteRoot": "."
}
],
"justMyCode": false
}
]
}
54 changes: 54 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.tsc.autoDetect": "off",
"json.schemas": [
{
"fileMatch": [
"/*electron-builder.json5",
"/*electron-builder.json"
],
"url": "https://json.schemastore.org/electron-builder"
}
],
"cSpell.words": [
"Eigent"
],
"i18n-ally.localesPaths": [
"backend/lang",
"server/lang",
"src/i18n",
"src/i18n/locales"
],
// Prettier & ESLint configuration
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "explicit"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.requireConfig": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
]
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"label": "Before Debug",
"type": "shell",
"command": "node .vscode/.debug.script.js",
"command": "node .vscode/.debug.script.mjs",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
Expand Down
50 changes: 4 additions & 46 deletions src/components/SearchHistoryDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@

'use client';

import { ScanFace, Search, Trash2 } from 'lucide-react';
import { ScanFace, Search } from 'lucide-react';
import { useEffect, useState } from 'react';

import { proxyFetchDelete } from '@/api/http';
import GroupedHistoryView from '@/components/GroupedHistoryView';
import {
CommandDialog,
Expand All @@ -31,7 +30,6 @@ import {
import useChatStoreAdapter from '@/hooks/useChatStoreAdapter';
import { replayProject } from '@/lib';
import { fetchHistoryTasks } from '@/service/historyApi';
import { getAuthStore } from '@/store/authStore';
import { useGlobalStore } from '@/store/globalStore';
import { VisuallyHidden } from '@radix-ui/react-visually-hidden';
import { useTranslation } from 'react-i18next';
Expand Down Expand Up @@ -76,35 +74,9 @@ export function SearchHistoryDialog() {
await replayProject(projectStore, navigate, projectId, question, historyId);
};

const handleDelete = async (historyId: string, callback?: () => void) => {
try {
await proxyFetchDelete(`/api/chat/history/${historyId}`);

// Also delete local files for this task if available (via Electron IPC)
const history = historyTasks.find(
(item) => String(item.id) === String(historyId)
);
const { email } = getAuthStore();
if (history?.task_id && (window as any).ipcRenderer) {
try {
await (window as any).ipcRenderer.invoke(
'delete-task-files',
email,
history.task_id,
history.project_id ?? undefined
);
} catch (error) {
console.warn('Local file cleanup failed:', error);
}
}

setHistoryTasks((list) =>
list.filter((item) => String(item.id) !== String(historyId))
);
callback?.();
} catch (error) {
console.error('Failed to delete history task:', error);
}
const handleDelete = (taskId: string) => {
// TODO: Implement delete functionality similar to HistorySidebar
console.log('Delete task:', taskId);
};

const handleShare = (taskId: string) => {
Expand Down Expand Up @@ -165,20 +137,6 @@ export function SearchHistoryDialog() {
<div className="overflow-hidden text-ellipsis whitespace-nowrap">
{task.question}
</div>
<Button
type="button"
variant="ghost"
size="icon"
className="text-muted-foreground hover:text-foreground ml-auto"
aria-label="Delete history"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
void handleDelete(String(task.id));
}}
>
<Trash2 size={16} />
</Button>
</CommandItem>
))}
</CommandGroup>
Expand Down
Loading
Loading