Shun Miyazawa 1 год назад
Родитель
Сommit
21da41648a

+ 1 - 0
apps/app/public/static/locales/en_US/translation.json

@@ -161,6 +161,7 @@
   "not_allowed_to_see_this_page": "You cannot see this page",
   "Confirm": "Confirm",
   "Successfully requested": "Successfully requested.",
+  "source": "Source",
   "input_validation": {
     "target": {
       "page_name": "Page name",

+ 1 - 0
apps/app/public/static/locales/fr_FR/translation.json

@@ -161,6 +161,7 @@
   "not_allowed_to_see_this_page": "Vous ne pouvez pas voir cette page",
   "Confirm": "Confirmer",
   "Successfully requested": "Demande envoyée.",
+  "source": "source",
   "input_validation": {
     "target": {
       "page_name": "Nom de la page",

+ 1 - 0
apps/app/public/static/locales/ja_JP/translation.json

@@ -162,6 +162,7 @@
   "not_allowed_to_see_this_page": "このページは閲覧できません",
   "Confirm": "確認",
   "Successfully requested": "正常に処理を受け付けました",
+  "source": "出典",
   "input_validation": {
     "target": {
       "page_name": "ページ名",

+ 1 - 0
apps/app/public/static/locales/zh_CN/translation.json

@@ -168,6 +168,7 @@
   "Confirm": "确定",
   "Successfully requested": "进程成功接受",
   "copied_to_clipboard": "它已复制到剪贴板。",
+  "source": "消息来源",
   "input_validation": {
     "target": {
       "page_name": "页面名称",

+ 3 - 1
apps/app/src/features/openai/server/services/annotation-replacer.ts

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