|
@@ -4,6 +4,7 @@ import type { IPageHasId } from '@growi/core/dist/interfaces';
|
|
|
import type { MessageDelta } from 'openai/resources/beta/threads/messages.mjs';
|
|
import type { MessageDelta } from 'openai/resources/beta/threads/messages.mjs';
|
|
|
|
|
|
|
|
import VectorStoreFileRelationModel, { type VectorStoreFileRelation } from '~/features/openai/server/models/vector-store-file-relation';
|
|
import VectorStoreFileRelationModel, { type VectorStoreFileRelation } from '~/features/openai/server/models/vector-store-file-relation';
|
|
|
|
|
+import { configManager } from '~/server/service/config-manager';
|
|
|
import { getTranslation } from '~/server/service/i18next';
|
|
import { getTranslation } from '~/server/service/i18next';
|
|
|
|
|
|
|
|
type PopulatedVectorStoreFileRelation = Omit<VectorStoreFileRelation, 'pageId'> & { pageId: IPageHasId }
|
|
type PopulatedVectorStoreFileRelation = Omit<VectorStoreFileRelation, 'pageId'> & { pageId: IPageHasId }
|
|
@@ -22,9 +23,10 @@ export const annotationReplacer = async(delta: MessageDelta): Promise<void> => {
|
|
|
|
|
|
|
|
if (vectorStoreFileRelation != null) {
|
|
if (vectorStoreFileRelation != null) {
|
|
|
const { t } = await getTranslation();
|
|
const { t } = await getTranslation();
|
|
|
|
|
+ const appSiteUrl = configManager?.getConfig('crowi', 'app:siteUrl');
|
|
|
content.text.value = content.text.value?.replace(
|
|
content.text.value = content.text.value?.replace(
|
|
|
annotation.text,
|
|
annotation.text,
|
|
|
- ` [${t('source')}:[${vectorStoreFileRelation.pageId.path}](http://localhost:3000/${vectorStoreFileRelation.pageId._id})]`,
|
|
|
|
|
|
|
+ ` [${t('source')}: [${vectorStoreFileRelation.pageId.path}](${appSiteUrl}/${vectorStoreFileRelation.pageId._id})]`,
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|