Jelajahi Sumber

Add IApiv3DeleteThreadParams

Shun Miyazawa 1 tahun lalu
induk
melakukan
a327183d13

+ 1 - 1
apps/app/src/features/openai/client/components/AiAssistant/Sidebar/AiAssistantTree.tsx

@@ -37,7 +37,7 @@ const ThreadItem: React.FC<ThreadItemProps> = ({
 
 
   const deleteThreadHandler = useCallback(async() => {
   const deleteThreadHandler = useCallback(async() => {
     try {
     try {
-      await deleteThread(aiAssistantData._id, threadData._id);
+      await deleteThread({ aiAssistantId: aiAssistantData._id, threadRelationId: threadData._id });
       toastSuccess('スレッドを削除しました');
       toastSuccess('スレッドを削除しました');
       onThreadDelete();
       onThreadDelete();
     }
     }

+ 4 - 2
apps/app/src/features/openai/client/services/thread.ts

@@ -1,5 +1,7 @@
 import { apiv3Delete } from '~/client/util/apiv3-client';
 import { apiv3Delete } from '~/client/util/apiv3-client';
 
 
-export const deleteThread = async(aiAssistantId: string, threadRelationId: string): Promise<void> => {
-  await apiv3Delete(`/openai/thread/${aiAssistantId}/${threadRelationId}`);
+import type { IApiv3DeleteThreadParams } from '../../interfaces/thread-relation';
+
+export const deleteThread = async(params: IApiv3DeleteThreadParams): Promise<void> => {
+  await apiv3Delete(`/openai/thread/${params.aiAssistantId}/${params.threadRelationId}`);
 };
 };

+ 5 - 0
apps/app/src/features/openai/interfaces/thread-relation.ts

@@ -11,3 +11,8 @@ export interface IThreadRelation {
 }
 }
 
 
 export type IThreadRelationHasId = IThreadRelation & HasObjectId;
 export type IThreadRelationHasId = IThreadRelation & HasObjectId;
+
+export type IApiv3DeleteThreadParams = {
+  aiAssistantId: string
+  threadRelationId: string;
+}