Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix(ci): repair i18n bridge and translation workflow (#34738)
yyh208604a3a819
diff --git a/.github/scripts/generate-i18n-changes.mjs b/.github/scripts/generate-i18n-changes.mjsnew file mode 100644index 00000000000..3d25115ac34--- /dev/null+++ b/.github/scripts/generate-i18n-changes.mjs@@ -0,0 +1,82 @@+import { execFileSync } from 'node:child_process'+import fs from 'node:fs'+import path from 'node:path'++const repoRoot = process.cwd()+const baseSha = process.env.BASE_SHA || ''+const headSha = process.env.HEAD_SHA || ''+const files = (process.env.CHANGED_FILES || '').split(/\s+/).filter(Boolean)+const outputPath = process.env.I18N_CHANGES_OUTPUT_PATH || '/tmp/i18n-changes.json'++const englishPath = fileStem => path.join(repoRoot, 'web', 'i18n', 'en-US', `${fileStem}.json`)++const readCurrentJson = (fileStem) => {+ const filePath = englishPath(fileStem)+ if (!fs.existsSync(filePath))+ return null++ return JSON.parse(fs.readFileSync(filePath, 'utf8'))+}++const readBaseJson = (fileStem) => {+ if (!baseSha)+ return null++ try {+ const relativePath = `web/i18n/en-US/${fileStem}.json`+ const content = execFileSync('git', ['show', `${baseSha}:${relativePath}`], { encoding: 'utf8' })+ return JSON.parse(content)+ }+ catch {+ return null+ }+}++const compareJson = (beforeValue, afterValue) => JSON.stringify(beforeValue) === JSON.stringify(afterValue)++const changes = {}++for (const fileStem of files) {+ const currentJson = readCurrentJson(fileStem)+ const beforeJson = readBaseJson(fileStem) || {}+ const afterJson = currentJson || {}+ const added = {}+ const updated = {}+ const deleted = []++ for (const [key, value] of Object.entries(afterJson)) {+ if (!(key in beforeJson)) {+ added[key] = value+ continue+ }++ if (!compareJson(beforeJson[key], value)) {+ updated[key] = {+ before: beforeJson[key],+ after: value,+ }+ }+ }++ for (const key of Object.keys(beforeJson)) {+ if (!(key in afterJson))+ deleted.push(key)+ }++ changes[fileStem] = {+ fileDeleted: currentJson === null,+ added,+ updated,+ deleted,+ }+}++fs.writeFileSync(+ outputPath,+ JSON.stringify({+ baseSha,+ headSha,+ files,+ changes,+ })+)diff --git a/.github/workflows/translate-i18n-claude.yml b/.github/workflows/translate-i18n-claude.ymlindex a813c87cece..e001f4d6774 100644--- a/.github/workflows/translate-i18n-claude.yml+++ b/.github/workflows/translate-i18n-claude.yml@@ -68,89 +68,7 @@ jobs:" web/i18n-config/languages.ts | sed 's/[[:space:]]*$//')generate_changes_json() {- node <<'NODE'- const { execFileSync } = require('node:child_process')- const fs = require('node:fs')- const path = require('node:path')-- const repoRoot = process.cwd()- const baseSha = process.env.BASE_SHA || ''- const headSha = process.env.HEAD_SHA || ''- const files = (process.env.CHANGED_FILES || '').split(/\s+/).filter(Boolean)-- const englishPath = fileStem => path.join(repoRoot, 'web', 'i18n', 'en-US', `${fileStem}.json`)-- const readCurrentJson = (fileStem) => {- const filePath = englishPath(fileStem)- if (!fs.existsSync(filePath))- return null-- return JSON.parse(fs.readFileSync(filePath, 'utf8'))- }-- const readBaseJson = (fileStem) => {- if (!baseSha)- return null-- try {- const relativePath = `web/i18n/en-US/${fileStem}.json`- const content = execFileSync('git', ['show', `${baseSha}:${relativePath}`], { encoding: 'utf8' })- return JSON.parse(content)- }- catch (error) {- return null- }- }-- const compareJson = (beforeValue, afterValue) => JSON.stringify(beforeValue) === JSON.stringify(afterValue)-- const changes = {}-- for (const fileStem of files) {- const currentJson = readCurrentJson(fileStem)- const beforeJson = readBaseJson(fileStem) || {}- const afterJson = currentJson || {}- const added = {}- const updated = {}- const deleted = []-- for (const [key, value] of Object.entries(afterJson)) {- if (!(key in beforeJson)) {- added[key] = value- continue- }-- if (!compareJson(beforeJson[key], value)) {- updated[key] = {- before: beforeJson[key],- after: value,- }- }- }-- for (const key of Object.keys(beforeJson)) {- if (!(key in afterJson))- deleted.push(key)- }-- changes[fileStem] = {- fileDeleted: currentJson === null,- added,- updated,- deleted,- }- }-- fs.writeFileSync(- '/tmp/i18n-changes.json',- JSON.stringify({- baseSha,- headSha,- files,- changes,- })- )- NODE+ node .github/scripts/generate-i18n-changes.mjs}if [ "${{ github.event_name }}" = "repository_dispatch" ]; then@@ -270,7 +188,7 @@ jobs:Tool rules:- Use Read for repository files.- Use Edit for JSON updates.- - Use Bash only for `pnpm`.+ - Use Bash only for `vp`.- Do not use Bash for `git`, `gh`, or branch management.Required execution plan:@@ -292,7 +210,7 @@ jobs:- Read the current English JSON file for any file that still exists so wording, placeholders, and surrounding terminology stay accurate.- If `Structured change set available` is `false`, treat this as a scoped full sync and use the current English files plus scoped checks as the source of truth.4. Run a scoped pre-check before editing:- - `pnpm --dir ${{ github.workspace }}/web run i18n:check ${{ steps.context.outputs.FILE_ARGS }} ${{ steps.context.outputs.LANG_ARGS }}`+ - `vp run dify-web#i18n:check ${{ steps.context.outputs.FILE_ARGS }} ${{ steps.context.outputs.LANG_ARGS }}`- Use this command as the source of truth for missing and extra keys inside the current scope.5. Apply translations.- For every target language and scoped file:@@ -300,19 +218,19 @@ jobs:- If the locale file does not exist yet, create it with `Write` and then continue with `Edit` as needed.- ADD missing keys.- UPDATE stale translations when the English value changed.- - DELETE removed keys. Prefer `pnpm --dir ${{ github.workspace }}/web run i18n:check ${{ steps.context.outputs.FILE_ARGS }} ${{ steps.context.outputs.LANG_ARGS }} --auto-remove` for extra keys so deletions stay in scope.+ - DELETE removed keys. Prefer `vp run dify-web#i18n:check ${{ steps.context.outputs.FILE_ARGS }} ${{ steps.context.outputs.LANG_ARGS }} --auto-remove` for extra keys so deletions stay in scope.- Preserve placeholders exactly: `{{variable}}`, `${variable}`, HTML tags, component tags, and variable names.- Match the existing terminology and register used by each locale.- Prefer one Edit per file when stable, but prioritize correctness over batching.6. Verify only the edited files.- - Run `pnpm --dir ${{ github.workspace }}/web lint:fix --quiet -- <relative edited i18n file paths>`- - Run `pnpm --dir ${{ github.workspace }}/web run i18n:check ${{ steps.context.outputs.FILE_ARGS }} ${{ steps.context.outputs.LANG_ARGS }}`+ - Run `vp run dify-web#lint:fix --quiet -- <relative edited i18n file paths under web/>`+ - Run `vp run dify-web#i18n:check ${{ steps.context.outputs.FILE_ARGS }} ${{ steps.context.outputs.LANG_ARGS }}`- If verification fails, fix the remaining problems before continuing.7. Stop after the scoped locale files are updated and verification passes.- Do not create branches, commits, or pull requests.claude_args: |--max-turns 120- --allowedTools "Read,Write,Edit,Bash(pnpm *),Bash(pnpm:*),Glob,Grep"+ --allowedTools "Read,Write,Edit,Bash(vp *),Bash(vp:*),Glob,Grep"- name: Prepare branch metadataid: pr_meta@@ -354,6 +272,7 @@ jobs:- name: Create or update translation PRif: steps.pr_meta.outputs.has_changes == 'true'env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}BRANCH_NAME: ${{ steps.pr_meta.outputs.branch_name }}FILES_IN_SCOPE: ${{ steps.context.outputs.CHANGED_FILES }}TARGET_LANGS: ${{ steps.context.outputs.TARGET_LANGS }}@@ -402,8 +321,8 @@ jobs:'','## Verification','',- `- \`pnpm --dir web run i18n:check --file ${process.env.FILES_IN_SCOPE} --lang ${process.env.TARGET_LANGS}\``,- `- \`pnpm --dir web lint:fix --quiet -- <edited i18n files>\``,+ `- \`vp run dify-web#i18n:check --file ${process.env.FILES_IN_SCOPE} --lang ${process.env.TARGET_LANGS}\``,+ `- \`vp run dify-web#lint:fix --quiet -- <edited i18n files under web/>\``,'','## Notes','',diff --git a/.github/workflows/trigger-i18n-sync.yml b/.github/workflows/trigger-i18n-sync.ymlindex a1ca42b26ee..9a11d3e8df4 100644--- a/.github/workflows/trigger-i18n-sync.yml+++ b/.github/workflows/trigger-i18n-sync.yml@@ -42,88 +42,7 @@ jobs:fiexport BASE_SHA HEAD_SHA CHANGED_FILES- node <<'NODE'- const { execFileSync } = require('node:child_process')- const fs = require('node:fs')- const path = require('node:path')-- const repoRoot = process.cwd()- const baseSha = process.env.BASE_SHA || ''- const headSha = process.env.HEAD_SHA || ''- const files = (process.env.CHANGED_FILES || '').split(/\s+/).filter(Boolean)-- const englishPath = fileStem => path.join(repoRoot, 'web', 'i18n', 'en-US', `${fileStem}.json`)-- const readCurrentJson = (fileStem) => {- const filePath = englishPath(fileStem)- if (!fs.existsSync(filePath))- return null-- return JSON.parse(fs.readFileSync(filePath, 'utf8'))- }-- const readBaseJson = (fileStem) => {- if (!baseSha)- return null-- try {- const relativePath = `web/i18n/en-US/${fileStem}.json`- const content = execFileSync('git', ['show', `${baseSha}:${relativePath}`], { encoding: 'utf8' })- return JSON.parse(content)- }- catch (error) {- return null- }- }-- const compareJson = (beforeValue, afterValue) => JSON.stringify(beforeValue) === JSON.stringify(afterValue)-- const changes = {}-- for (const fileStem of files) {- const beforeJson = readBaseJson(fileStem) || {}- const afterJson = readCurrentJson(fileStem) || {}- const added = {}- const updated = {}- const deleted = []-- for (const [key, value] of Object.entries(afterJson)) {- if (!(key in beforeJson)) {- added[key] = value- continue- }-- if (!compareJson(beforeJson[key], value)) {- updated[key] = {- before: beforeJson[key],- after: value,- }- }- }-- for (const key of Object.keys(beforeJson)) {- if (!(key in afterJson))- deleted.push(key)- }-- changes[fileStem] = {- fileDeleted: readCurrentJson(fileStem) === null,- added,- updated,- deleted,- }- }-- fs.writeFileSync(- '/tmp/i18n-changes.json',- JSON.stringify({- baseSha,- headSha,- files,- changes,- })- )- NODE+ node .github/scripts/generate-i18n-changes.mjsif [ -n "$CHANGED_FILES" ]; thenecho "has_changes=true" >> "$GITHUB_OUTPUT"diff --git a/.vite-hooks/pre-commit b/.vite-hooks/pre-commitindex db5c5046060..13bbd81cf6d 100755--- a/.vite-hooks/pre-commit+++ b/.vite-hooks/pre-commit@@ -81,8 +81,8 @@ if $web_modified; thenif $web_ts_modified; thenecho "Running TypeScript type-check:tsgo"- if ! pnpm run type-check:tsgo; then- echo "Type check failed. Please run 'pnpm run type-check:tsgo' to fix the errors."+ if ! npm run type-check:tsgo; then+ echo "Type check failed. Please run 'npm run type-check:tsgo' to fix the errors."exit 1fielse@@ -90,8 +90,8 @@ if $web_modified; thenfiecho "Running knip"- if ! pnpm run knip; then- echo "Knip check failed. Please run 'pnpm run knip' to fix the errors."+ if ! npm run knip; then+ echo "Knip check failed. Please run 'npm run knip' to fix the errors."exit 1fidiff --git a/web/app/components/workflow/nodes/parameter-extractor/__tests__/integration.spec.tsx b/web/app/components/workflow/nodes/parameter-extractor/__tests__/integration.spec.tsxindex 60b9d652609..490f981268b 100644--- a/web/app/components/workflow/nodes/parameter-extractor/__tests__/integration.spec.tsx+++ b/web/app/components/workflow/nodes/parameter-extractor/__tests__/integration.spec.tsx@@ -22,6 +22,9 @@ import Panel from '../panel'import { ParamType, ReasoningModeType } from '../types'import useConfig from '../use-config'+const reasoningModeFunctionToolCallingLabel = 'workflow.nodes.parameterExtractor.reasoningModeFunctionToolCalling'+const reasoningModePromptLabel = 'workflow.nodes.parameterExtractor.reasoningModePrompt'+type MockToolCollection = {id: stringtools: Array<{@@ -735,8 +738,8 @@ describe('parameter-extractor path', () => {/>,)- await user.click(screen.getByRole('button', { name: 'Function/Tool Calling' }))- await user.click(screen.getByRole('button', { name: 'Prompt' }))+ await user.click(screen.getByRole('button', { name: reasoningModeFunctionToolCallingLabel }))+ await user.click(screen.getByRole('button', { name: reasoningModePromptLabel }))expect(onChange).toHaveBeenNthCalledWith(1, ReasoningModeType.functionCall)expect(onChange).toHaveBeenNthCalledWith(2, ReasoningModeType.prompt)@@ -826,7 +829,7 @@ describe('parameter-extractor path', () => {target: { value: 'Extract city, budget, and due date' },})await user.click(screen.getByRole('button', { name: 'memory-config' }))- await user.click(screen.getByRole('button', { name: 'Function/Tool Calling' }))+ await user.click(screen.getByRole('button', { name: reasoningModeFunctionToolCallingLabel }))expect(handleModelChanged).toHaveBeenCalledWith({provider: 'anthropic',diff --git a/web/app/components/workflow/nodes/parameter-extractor/components/reasoning-mode-picker.tsx b/web/app/components/workflow/nodes/parameter-extractor/components/reasoning-mode-picker.tsxindex 68d050ff67b..c4b8809ffe2 100644--- a/web/app/components/workflow/nodes/parameter-extractor/components/reasoning-mode-picker.tsx+++ b/web/app/components/workflow/nodes/parameter-extractor/components/reasoning-mode-picker.tsx@@ -33,12 +33,12 @@ const ReasoningModePicker: FC<Props> = ({><div className="grid grid-cols-2 gap-x-1"><OptionCard- title="Function/Tool Calling"+ title={t(`${i18nPrefix}.reasoningModeFunctionToolCalling`, { ns: 'workflow' })}onSelect={handleChange(ReasoningModeType.functionCall)}selected={type === ReasoningModeType.functionCall}/><OptionCard- title="Prompt"+ title={t(`${i18nPrefix}.reasoningModePrompt`, { ns: 'workflow' })}selected={type === ReasoningModeType.prompt}onSelect={handleChange(ReasoningModeType.prompt)}/>diff --git a/web/i18n/en-US/workflow.json b/web/i18n/en-US/workflow.jsonindex 5c7df027911..6f6e5de2ccb 100644--- a/web/i18n/en-US/workflow.json+++ b/web/i18n/en-US/workflow.json@@ -856,6 +856,8 @@"nodes.parameterExtractor.outputVars.isSuccess": "Is Success.On success the value is 1, on failure the value is 0.","nodes.parameterExtractor.outputVars.usage": "Model Usage Information","nodes.parameterExtractor.reasoningMode": "Reasoning Mode",+ "nodes.parameterExtractor.reasoningModeFunctionToolCalling": "Function/Tool Calling",+ "nodes.parameterExtractor.reasoningModePrompt": "Prompt","nodes.parameterExtractor.reasoningModeTip": "You can choose the appropriate reasoning mode based on the model's ability to respond to instructions for function calling or prompts.","nodes.questionClassifiers.addClass": "Add Class","nodes.questionClassifiers.advancedSetting": "Advanced Setting",