Skip to content

Commit

Permalink
perf: 优化子任务上下文
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaifan committed Dec 13, 2024
1 parent a8c890b commit 25be9c0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/Tasks/BotReceiveMsgTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,24 @@ private function AIGenerateSystemMessageOrBeforeText(int|null $userid, WebSocket
EOF;
}
}
$subTask = ProjectTask::select(['id', 'name', 'complete_at', 'end_at'])->whereParentId($taskInfo->id)->get();
if ($subTask->isNotEmpty()) {
$subTaskContent = $subTask->map(function($item) {
$status = "";
if ($item->complete_at) {
$status = " (已完成)";
} elseif ($item->end_at && Carbon::parse($item->end_at)->lt(Carbon::now())) {
$status = " (已过期)";
}
return " - {$item->name} {$status}";
})->join("\n");
if ($subTaskContent) {
$before_text[] = <<<EOF
子任务列表:
{$subTaskContent}
EOF;
}
}
$before_text[] = <<<EOF
如果你判断我想要添加子任务,请按照以下格式回复:
Expand Down

0 comments on commit 25be9c0

Please sign in to comment.