|
|
@@ -66,7 +66,7 @@ const convertPathPatternsToRegExp = (pagePathPatterns: string[]): Array<string |
|
|
|
};
|
|
|
|
|
|
export interface IOpenaiService {
|
|
|
- createThread(userId: string, threadType: ThreadType, aiAssistantId?: string, initialUserMessage?: string): Promise<ThreadRelationDocument>;
|
|
|
+ createThread(userId: string, type: ThreadType, aiAssistantId?: string, initialUserMessage?: string): Promise<ThreadRelationDocument>;
|
|
|
getThreadsByAiAssistantId(aiAssistantId: string): Promise<ThreadRelationDocument[]>
|
|
|
deleteThread(threadRelationId: string): Promise<ThreadRelationDocument>;
|
|
|
deleteExpiredThreads(limit: number, apiCallInterval: number): Promise<void>; // for CronJob
|
|
|
@@ -118,7 +118,7 @@ class OpenaiService implements IOpenaiService {
|
|
|
return threadTitle;
|
|
|
}
|
|
|
|
|
|
- async createThread(userId: string, threadType: ThreadType, aiAssistantId?: string, initialUserMessage?: string): Promise<ThreadRelationDocument> {
|
|
|
+ async createThread(userId: string, type: ThreadType, aiAssistantId?: string, initialUserMessage?: string): Promise<ThreadRelationDocument> {
|
|
|
let threadTitle: string | null = null;
|
|
|
if (initialUserMessage != null) {
|
|
|
try {
|
|
|
@@ -134,7 +134,7 @@ class OpenaiService implements IOpenaiService {
|
|
|
const thread = await this.client.createThread(vectorStoreRelation?.vectorStoreId);
|
|
|
const threadRelation = await ThreadRelationModel.create({
|
|
|
userId,
|
|
|
- threadType,
|
|
|
+ type,
|
|
|
aiAssistant: aiAssistantId,
|
|
|
threadId: thread.id,
|
|
|
title: threadTitle,
|
|
|
@@ -159,8 +159,8 @@ class OpenaiService implements IOpenaiService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async getThreadsByAiAssistantId(aiAssistantId: string, threadType: ThreadType = ThreadType.KNOWLEDGE): Promise<ThreadRelationDocument[]> {
|
|
|
- const threadRelations = await ThreadRelationModel.find({ aiAssistant: aiAssistantId, threadType });
|
|
|
+ async getThreadsByAiAssistantId(aiAssistantId: string, type: ThreadType = ThreadType.KNOWLEDGE): Promise<ThreadRelationDocument[]> {
|
|
|
+ const threadRelations = await ThreadRelationModel.find({ aiAssistant: aiAssistantId, type });
|
|
|
return threadRelations;
|
|
|
}
|
|
|
|