feat: set timeout for new-chat & resume-chat

This commit is contained in:
d-kimsuon
2025-09-06 23:38:49 +09:00
parent 52a231bc0a
commit d0fdadeefa
2 changed files with 22 additions and 8 deletions

View File

@@ -21,10 +21,17 @@ export const NewChat: FC<{
mutationFn: async (options: { message: string }) => {
const response = await honoClient.api.projects[":projectId"][
"new-session"
].$post({
param: { projectId },
json: { message: options.message },
});
].$post(
{
param: { projectId },
json: { message: options.message },
},
{
init: {
signal: AbortSignal.timeout(10 * 1000),
},
},
);
if (!response.ok) {
throw new Error(response.statusText);

View File

@@ -24,10 +24,17 @@ export const ResumeChat: FC<{
mutationFn: async (options: { message: string }) => {
const response = await honoClient.api.projects[":projectId"].sessions[
":sessionId"
].resume.$post({
param: { projectId, sessionId },
json: { resumeMessage: options.message },
});
].resume.$post(
{
param: { projectId, sessionId },
json: { resumeMessage: options.message },
},
{
init: {
signal: AbortSignal.timeout(10 * 1000),
},
},
);
if (!response.ok) {
throw new Error(response.statusText);