mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-27 09:46:25 +02:00
refactor: enhance write_todos tool and system prompt
- Updated the write_todos tool to include an optional description field for todo items, improving task detail management. - Enhanced the system prompt with clearer guidelines on using the write_todos tool, including refined usage patterns and examples for various user scenarios. - Improved UI components to support the new description feature, ensuring better visibility of task details during planning and execution. - Streamlined the code for better readability and maintainability, aligning with recent refactoring efforts.
This commit is contained in:
parent
ebc04f590e
commit
8a3ab3dfac
5 changed files with 197 additions and 235 deletions
|
|
@ -19,39 +19,59 @@ import { Plan, PlanErrorBoundary, parseSerializablePlan, TodoStatusSchema } from
|
|||
|
||||
/**
|
||||
* Schema for a single todo item in the args
|
||||
* Note: Using nullish() with transform to convert null → undefined for Plan compatibility
|
||||
*/
|
||||
const WriteTodosArgsTodoSchema = z.object({
|
||||
id: z.string(),
|
||||
content: z.string(),
|
||||
status: TodoStatusSchema,
|
||||
description: z
|
||||
.string()
|
||||
.nullish()
|
||||
.transform((v) => v ?? undefined),
|
||||
});
|
||||
|
||||
/**
|
||||
* Schema for write_todos tool arguments
|
||||
* Note: Using nullish() with transform to convert null → undefined for Plan compatibility
|
||||
*/
|
||||
const WriteTodosArgsSchema = z.object({
|
||||
title: z.string().nullish(),
|
||||
description: z.string().nullish(),
|
||||
title: z
|
||||
.string()
|
||||
.nullish()
|
||||
.transform((v) => v ?? undefined),
|
||||
description: z
|
||||
.string()
|
||||
.nullish()
|
||||
.transform((v) => v ?? undefined),
|
||||
todos: z.array(WriteTodosArgsTodoSchema).nullish(),
|
||||
});
|
||||
|
||||
/**
|
||||
* Schema for a single todo item in the result
|
||||
* Note: Using nullish() with transform to convert null → undefined for Plan compatibility
|
||||
*/
|
||||
const WriteTodosResultTodoSchema = z.object({
|
||||
id: z.string(),
|
||||
label: z.string(),
|
||||
status: TodoStatusSchema,
|
||||
description: z.string().nullish(),
|
||||
description: z
|
||||
.string()
|
||||
.nullish()
|
||||
.transform((v) => v ?? undefined),
|
||||
});
|
||||
|
||||
/**
|
||||
* Schema for write_todos tool result
|
||||
* Note: Using nullish() with transform to convert null → undefined for Plan compatibility
|
||||
*/
|
||||
const WriteTodosResultSchema = z.object({
|
||||
id: z.string(),
|
||||
title: z.string(),
|
||||
description: z.string().nullish(),
|
||||
description: z
|
||||
.string()
|
||||
.nullish()
|
||||
.transform((v) => v ?? undefined),
|
||||
todos: z.array(WriteTodosResultTodoSchema),
|
||||
});
|
||||
|
||||
|
|
@ -93,6 +113,7 @@ function transformArgsToResult(args: WriteTodosArgs): WriteTodosResult | null {
|
|||
id: todo.id || `todo-${index}`,
|
||||
label: todo.content || "Task",
|
||||
status: todo.status || "pending",
|
||||
description: todo.description,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue