From 41406a8596a5e73901c063d1f5290e21071c314b Mon Sep 17 00:00:00 2001 From: Vincent VATELOT Date: Tue, 10 Dec 2024 16:09:06 +0100 Subject: [PATCH 1/9] i18n(fr): Add french translations --- i18n/i18next-config.ts | 11 +++++ i18n/index.ts | 2 +- i18n/lang/app.fr.ts | 37 +++++++++++++++ i18n/lang/common.fr.ts | 34 ++++++++++++++ i18n/lang/tools.fr.ts | 104 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 i18n/lang/app.fr.ts create mode 100644 i18n/lang/common.fr.ts create mode 100644 i18n/lang/tools.fr.ts diff --git a/i18n/i18next-config.ts b/i18n/i18next-config.ts index 522fa39..d091cdf 100644 --- a/i18n/i18next-config.ts +++ b/i18n/i18next-config.ts @@ -6,15 +6,18 @@ import commonEs from './lang/common.es' import commonZh from './lang/common.zh' import commonVi from './lang/common.vi' import commonJa from './lang/common.ja' +import commonFr from './lang/common.fr' import appEn from './lang/app.en' import appEs from './lang/app.es' import appZh from './lang/app.zh' import appVi from './lang/app.vi' import appJa from './lang/app.ja' +import appFr from './lang/app.fr' import toolsEn from './lang/tools.en' import toolsZh from './lang/tools.zh' import toolsVi from './lang/tools.vi' import toolsJa from './lang/tools.ja' +import toolsFr from './lang/tools.fr' import type { Locale } from '.' @@ -57,6 +60,14 @@ const resources = { tools: toolsJa, }, }, + 'fr': { + translation: { + common: commonFr, + app: appFr, + // tools + tools: toolsFr, + }, + }, } i18n.use(initReactI18next) diff --git a/i18n/index.ts b/i18n/index.ts index 1a2729f..82a212b 100644 --- a/i18n/index.ts +++ b/i18n/index.ts @@ -1,6 +1,6 @@ export const i18n = { defaultLocale: 'en', - locales: ['en', 'es', 'zh-Hans', 'ja'], + locales: ['en', 'es', 'zh-Hans', 'ja', 'fr'], } as const export type Locale = typeof i18n['locales'][number] diff --git a/i18n/lang/app.fr.ts b/i18n/lang/app.fr.ts new file mode 100644 index 0000000..6850077 --- /dev/null +++ b/i18n/lang/app.fr.ts @@ -0,0 +1,37 @@ +const translation = { + common: { + welcome: 'Bienvenue sur l\'application', + appUnavailable: 'L\'application n\'est pas disponible', + appUnkonwError: 'L\'application n\'est pas disponible', + }, + chat: { + newChat: 'Nouvelle conversation', + newChatDefaultName: 'Nouvelle conversation', + openingStatementTitle: 'Phrase d\'ouverture', + powerBy: 'Propulsé par', + prompt: 'Prompt', + privatePromptConfigTitle: 'Param tres de la conversation', + publicPromptConfigTitle: 'Prompt initial', + configStatusDes: 'Avant de commencer, vous pouvez modifier les paramètres de la conversation', + configDisabled: + 'Les paramètres de la session précédente ont été utilisés pour cette session.', + startChat: 'Démarrer la conversation', + privacyPolicyLeft: + 'Veuillez lire la ', + privacyPolicyMiddle: + 'politique de confidentialité ', + privacyPolicyRight: + ' fournie par le développeur de l\'application.', + }, + errorMessage: { + valueOfVarRequired: 'La valeur des variables ne peut pas être vide', + waitForResponse: + 'Veuillez attendre que la réponse au message précédent soit terminée.', + }, + variableTable: { + optional: 'Facultatif', + }, +} + +export default translation + diff --git a/i18n/lang/common.fr.ts b/i18n/lang/common.fr.ts new file mode 100644 index 0000000..9389d85 --- /dev/null +++ b/i18n/lang/common.fr.ts @@ -0,0 +1,34 @@ +const translation = { + api: { + success: 'Succès', + saved: 'Enregistré', + create: 'Créé', + }, + operation: { + confirm: 'Confirmer', + cancel: 'Annuler', + clear: 'Effacer', + save: 'Enregistrer', + edit: 'Éditer', + refresh: 'Redémarrer', + search: 'Rechercher', + send: 'Envoyer', + lineBreak: 'Saut de ligne', + like: 'like', + dislike: 'dislike', + ok: 'D\'accord', + }, + imageUploader: { + uploadFromComputer: 'Télécharger depuis l\'ordinateur', + uploadFromComputerReadError: 'Édition de l\'image échouée, veuillez essayer à nouveau.', + uploadFromComputerUploadError: 'Édition de l\'image échouée, veuillez télécharger à nouveau.', + uploadFromComputerLimit: 'Les images téléchargées ne peuvent pas dépasser {{size}} Mo', + pasteImageLink: 'Coller le lien de l\'image', + pasteImageLinkInputPlaceholder: 'Coller le lien de l\'image ici', + pasteImageLinkInvalid: 'Lien d\'image invalide', + imageUpload: 'Téléchargement d\'image', + }, +} + +export default translation + diff --git a/i18n/lang/tools.fr.ts b/i18n/lang/tools.fr.ts new file mode 100644 index 0000000..d6aeb25 --- /dev/null +++ b/i18n/lang/tools.fr.ts @@ -0,0 +1,104 @@ +const translation = { + title: 'Outils', + createCustomTool: 'Créer un outil personnalisé', + type: { + all: 'Tous', + builtIn: 'Intégré', + custom: 'Personnalisé', + }, + contribute: { + line1: 'Je suis intéressé pour ', + line2: ' contribuer à des outils de Dify.', + viewGuide: 'Voir le guide', + }, + author: 'Par', + auth: { + unauthorized: 'Autoriser', + authorized: 'Autorisé', + setup: 'Configurer l\'autorisation pour utiliser', + setupModalTitle: 'Configurer l\'autorisation', + setupModalTitleDescription: 'Aprèss avoir configuré les informations d\'identification, tous les membres de l\'espace de travail pourront utiliser cet outil pour orchestrer les applications.', + }, + includeToolNum: '{{num}} outils inclus', + addTool: 'Ajouter un outil', + createTool: { + title: 'Créer un outil personnalisé', + editAction: 'Configurer', + editTitle: 'Éditer l\'outil personnalisé', + name: 'Nom', + toolNamePlaceHolder: 'Saisissez le nom de l\'outil', + schema: 'Schéma', + schemaPlaceHolder: 'Saisissez votre schéma OpenAPI ici', + viewSchemaSpec: 'Voir la spécification OpenAPI-Swagger', + importFromUrl: 'Importer depuis une URL', + importFromUrlPlaceHolder: 'https://...', + urlError: 'Veuillez saisir une URL valide', + examples: 'Exemples', + exampleOptions: { + json: 'Météo (JSON)', + yaml: 'Pet Store (YAML)', + blankTemplate: 'Modèle vide', + }, + availableTools: { + title: 'Outils disponibles', + name: 'Nom', + description: 'Description', + method: 'Méthode', + path: 'Chemin', + action: 'Actions', + test: 'Test', + }, + authMethod: { + title: 'Méthode d\'autorisation', + type: 'Type d\'autorisation', + types: { + none: 'Aucun', + api_key: 'Clé API', + }, + key: 'Clé', + value: 'Valeur', + }, + privacyPolicy: 'Politique de confidentialité', + privacyPolicyPlaceholder: 'Veuillez saisir la politique de confidentialité', + }, + test: { + title: 'Test', + parametersValue: 'Paramètres & Valeurs', + parameters: 'Paramètres', + value: 'Valeurs', + testResult: 'Résultats du test', + testResultPlaceholder: 'Le résultat du test sera affiché ici', + }, + thought: { + using: 'En cours d\'utilisation', + used: 'Utilisé', + requestTitle: 'Demande ', + responseTitle: 'Réponse de ', + }, + setBuiltInTools: { + info: 'Informations', + setting: 'Paramétrage', + toolDescription: 'Description de l\'outil', + parameters: 'paramètres', + string: 'chaine de caractères', + number: 'nombre', + required: 'Requis', + infoAndSetting: 'Informations & Paramétrage', + }, + noCustomTool: { + title: 'Aucun outil personnalisé !', + content: 'Ajoutez et gérez vos outils personnalisé pour créer des applications d\'apprentissage automatique.', + createTool: 'Créer un outil', + }, + noSearchRes: { + title: 'Désolé, pas de résultats!', + content: 'Nous n\'avons pas trouvé d\'outils qui correspondent à votre recherche.', + reset: 'Réinitialiser la recherche', + }, + builtInPromptTitle: 'Suggestion', + toolRemoved: 'Outil supprimé', + notAuthorized: 'Outil non autorisé', +} + +export default translation + From a8ea35e5c60852231076b9cb170817d63aa788d7 Mon Sep 17 00:00:00 2001 From: p-sunshijun Date: Wed, 11 Dec 2024 18:08:47 +0800 Subject: [PATCH 2/9] fix: add new setting item to disable/enable same site property fixes #55 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 孙世军 <1083433931@qq.com> --- .idea/workspace.xml | 65 +++++++++++++++++++++++++++++++++++++++++ app/api/utils/common.ts | 7 +++-- config/index.ts | 1 + types/app.ts | 1 + 4 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..ae1f338 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + \ No newline at end of file diff --git a/app/api/utils/common.ts b/app/api/utils/common.ts index 109ee4b..27c1126 100644 --- a/app/api/utils/common.ts +++ b/app/api/utils/common.ts @@ -1,7 +1,7 @@ import { type NextRequest } from 'next/server' import { ChatClient } from 'dify-client' import { v4 } from 'uuid' -import { API_KEY, API_URL, APP_ID } from '@/config' +import { API_KEY, API_URL, APP_ID, APP_INFO } from '@/config' const userPrefix = `user_${APP_ID}:` @@ -15,7 +15,10 @@ export const getInfo = (request: NextRequest) => { } export const setSession = (sessionId: string) => { - return { 'Set-Cookie': `session_id=${sessionId}` } + if (APP_INFO.disable_session_same_site) + return { 'Set-Cookie': `session_id=${sessionId}; SameSite=None; Secure` } + + return { 'Set-Cookie': `session_id=${sessionId}` } } export const client = new ChatClient(API_KEY, API_URL || undefined) diff --git a/config/index.ts b/config/index.ts index eb726f1..74c9758 100644 --- a/config/index.ts +++ b/config/index.ts @@ -8,6 +8,7 @@ export const APP_INFO: AppInfo = { copyright: '', privacy_policy: '', default_language: 'en', + disable_session_same_site: false, // set it to true if you want to embed the chatbot in an iframe } export const isShowPrompt = false diff --git a/types/app.ts b/types/app.ts index 3d62c4f..197f6be 100644 --- a/types/app.ts +++ b/types/app.ts @@ -108,6 +108,7 @@ export type AppInfo = { default_language: Locale copyright?: string privacy_policy?: string + disable_session_same_site?: boolean } export enum Resolution { From 87c81b99dd628c4f09dce490acaef9314ede5915 Mon Sep 17 00:00:00 2001 From: Shijun Sun <30999793+AllForNothing@users.noreply.github.com> Date: Wed, 11 Dec 2024 18:28:19 +0800 Subject: [PATCH 3/9] Delete .idea/workspace.xml --- .idea/workspace.xml | 65 --------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index ae1f338..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - \ No newline at end of file From db4e78d796f196dabd833474b81a9993b8709c48 Mon Sep 17 00:00:00 2001 From: Laurel-rao <42195541+Laurel-rao@users.noreply.github.com> Date: Tue, 4 Mar 2025 14:51:29 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20iphone=20=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E7=82=B9=E5=87=BB=E8=81=8A=E5=A4=A9=E6=A1=86=E6=94=BE?= =?UTF-8?q?=E5=A4=A7=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/chat/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/chat/index.tsx b/app/components/chat/index.tsx index e257a6c..3dcb5df 100644 --- a/app/components/chat/index.tsx +++ b/app/components/chat/index.tsx @@ -172,7 +172,7 @@ const Chat: FC = ({ }