|
|
@@ -1171,12 +1171,10 @@ class PageService implements IPageService {
|
|
|
);
|
|
|
|
|
|
if (isAiEnabled()) {
|
|
|
- // TODO: https://redmine.weseek.co.jp/issues/160336
|
|
|
const { getOpenaiService } = await import('~/features/openai/server/services/openai');
|
|
|
-
|
|
|
- // Do not await because communication with OpenAI takes time
|
|
|
const openaiService = getOpenaiService();
|
|
|
- // openaiService?.createVectorStoreFile([duplicatedTarget]);
|
|
|
+ // Do not await because communication with OpenAI takes time
|
|
|
+ openaiService?.createVectorStoreFileOnPageCreate([duplicatedTarget]);
|
|
|
}
|
|
|
}
|
|
|
this.pageEvent.emit('duplicate', page, user);
|
|
|
@@ -1409,16 +1407,14 @@ class PageService implements IPageService {
|
|
|
await Revision.insertMany(newRevisions, { ordered: false });
|
|
|
await this.duplicateTags(pageIdMapping);
|
|
|
|
|
|
- const duplicatedPagesWithPopulatedToShowRevison = await Page
|
|
|
- .find({ _id: { $in: duplicatedPageIds }, grant: PageGrant.GRANT_PUBLIC }).populate('revision') as PageDocument[];
|
|
|
+ const duplicatedPagesWithPopulatedToShowRevision: HydratedDocument<PageDocument>[] = await Page
|
|
|
+ .find({ _id: { $in: duplicatedPageIds }, grant: PageGrant.GRANT_PUBLIC }).populate('revision');
|
|
|
|
|
|
if (isAiEnabled()) {
|
|
|
- // TODO: https://redmine.weseek.co.jp/issues/160336
|
|
|
const { getOpenaiService } = await import('~/features/openai/server/services/openai');
|
|
|
-
|
|
|
- // Do not await because communication with OpenAI takes time
|
|
|
const openaiService = getOpenaiService();
|
|
|
- // openaiService?.createVectorStoreFile(duplicatedPagesWithPopulatedToShowRevison);
|
|
|
+ // Do not await because communication with OpenAI takes time
|
|
|
+ openaiService?.createVectorStoreFileOnPageCreate(duplicatedPagesWithPopulatedToShowRevision);
|
|
|
}
|
|
|
}
|
|
|
|