enhance: start chat after replay

This commit is contained in:
a7m-1st 2025-10-20 01:38:12 +03:00
parent 28837b4c96
commit da65d3a520
3 changed files with 9 additions and 1 deletions

View file

@ -61,6 +61,9 @@ async def post(data: Chat, request: Request):
if data.is_cloud():
os.environ["cloud_api_key"] = data.api_key
# Put initial action in queue to start processing
await task_lock.put_queue(ActionImproveData(data=data.question))
chat_logger.info(f"Chat session initialized, starting streaming response for project_id: {data.project_id}")
return StreamingResponse(step_solve(data, request, task_lock), media_type="text/event-stream")

View file

@ -213,7 +213,9 @@ export default function ChatBox(): JSX.Element {
);
// Only start a new task if: pending, no messages processed yet
if (chatStore.tasks[_taskId as string].status === "pending" && !hasSimpleResponse && !hasComplexTask && !isFinished) {
// OR while or after replaying a project
if ((chatStore.tasks[_taskId as string].status === "pending" && !hasSimpleResponse && !hasComplexTask && !isFinished)
|| chatStore.tasks[_taskId].type === "replay") {
setMessage("");
// Pass the message content to startTask instead of adding it to current chatStore
const attachesToSend = JSON.parse(JSON.stringify(chatStore.tasks[_taskId]?.attaches)) || [];

View file

@ -429,6 +429,9 @@ const chatStore = (initial?: Partial<ChatStore>) => createStore<ChatStore>()(
targetChatStore.getState().setIsPending(newTaskId, false);
targetChatStore.getState().setDelayTime(newTaskId, delayTime as number);
targetChatStore.getState().setType(newTaskId, "replay");
//From handleSend if message is given
// Add the message to the new chatStore if provided
if (question) {