feat: implement task management store with IPC integration
- Added a new task store in `src-react/stores/task.ts` to manage tasks and their statuses. - Implemented functions for creating, executing, and retrying tasks, along with handling task progress and completion. - Introduced persistence for tasks using IPC. - Created utility functions for normalizing room types and building subtasks. - Added a new CSS file for global styles in `src-react/styles.css`. - Created runtime types in `src-react/types/runtime.ts` and exported them. - Updated the main entry points for Vue and React applications to support dynamic framework loading. - Refactored chat model interfaces and utility functions into `src/shared/chat-model.ts`. - Updated TypeScript configuration to include paths for React components and types. - Enhanced Vite configuration to support both Vue and React frameworks.
This commit is contained in:
@@ -230,7 +230,14 @@ export function runTaskOperationService() {
|
||||
ipcMain.handle(IPC_EVENTS.EXECUTE_SCRIPT, async (_event, options: any) => {
|
||||
try {
|
||||
const taskId = options.taskId || randomUUID();
|
||||
const roomType = options.roomList.find((item: any) => item.id === options.roomType);
|
||||
const roomTypeRaw = options.roomList.find((item: any) => item.id === options.roomType);
|
||||
const roomType = roomTypeRaw
|
||||
? {
|
||||
...roomTypeRaw,
|
||||
dyHotSpringName: roomTypeRaw.dyHotSpringName ?? roomTypeRaw.dyHotSrpingName,
|
||||
dyHotSrpingName: roomTypeRaw.dyHotSrpingName ?? roomTypeRaw.dyHotSpringName,
|
||||
}
|
||||
: null;
|
||||
|
||||
const pairs: Array<[string, string]> = [
|
||||
['fzName', 'fg_trace.js'],
|
||||
@@ -238,7 +245,12 @@ export function runTaskOperationService() {
|
||||
['dyHotelName', 'dy_hotel_trace.js'],
|
||||
['dyHotSpringName', 'dy_hot_spring_trace.js']
|
||||
]
|
||||
const scriptEntries = pairs.filter(([prop]) => roomType?.[prop])
|
||||
const scriptEntries = pairs.filter(([prop]) => {
|
||||
if (prop === 'dyHotSpringName') {
|
||||
return roomType?.dyHotSpringName || roomType?.dyHotSrpingName
|
||||
}
|
||||
return roomType?.[prop]
|
||||
})
|
||||
|
||||
const scriptsDir = getScriptsDir()
|
||||
|
||||
@@ -301,7 +313,9 @@ export function runTaskOperationService() {
|
||||
const result = await executeScriptServiceInstance.executeScript(
|
||||
item.scriptPath,
|
||||
{
|
||||
roomType: roomType[item.channel],
|
||||
roomType: item.channel === 'dyHotSpringName'
|
||||
? (roomType.dyHotSpringName || roomType.dyHotSrpingName)
|
||||
: roomType[item.channel],
|
||||
startTime: options.startTime,
|
||||
endTime: options.endTime,
|
||||
operation: options.operation,
|
||||
|
||||
Reference in New Issue
Block a user