修正getTaskDetail無法查看記憶區的任務

This commit is contained in:
siage 2025-04-21 17:55:04 +08:00
parent a5939f2418
commit a73f3a0105

View File

@ -1473,9 +1473,12 @@ export async function getTaskDetail({
taskId, taskId,
}: z.infer<typeof getTaskDetailSchema>) { }: z.infer<typeof getTaskDetailSchema>) {
try { try {
// 檢查任務是否存在 // 使用 searchTasksWithCommand 替代 getTaskById實現記憶區任務搜索
const task = await getTaskById(taskId); // 設置 isId 為 true表示按 ID 搜索;頁碼為 1每頁大小為 1
if (!task) { const result = await searchTasksWithCommand(taskId, true, 1, 1);
// 檢查是否找到任務
if (result.tasks.length === 0) {
return { return {
content: [ content: [
{ {
@ -1487,6 +1490,9 @@ export async function getTaskDetail({
}; };
} }
// 獲取找到的任務(第一個也是唯一的一個)
const task = result.tasks[0];
// 使用prompt生成器獲取最終prompt // 使用prompt生成器獲取最終prompt
const prompt = getGetTaskDetailPrompt({ const prompt = getGetTaskDetailPrompt({
taskId, taskId,