This commit is contained in:
Alter-xyz
2025-07-19 00:33:20 +08:00
parent b0312f6d6a
commit 299336b13a

View File

@@ -0,0 +1,649 @@
app:
description: ''
icon: 🤖
icon_background: '#FFEAD5'
mode: workflow
name: Doc Translate
use_icon_as_answer_icon: false
dependencies:
- current_identifier: null
type: marketplace
value:
marketplace_plugin_unique_identifier: langgenius/openai:0.0.30@1f5ecdef108418a467e54da2dcf5de2cf22b47632abc8633194ac9fb96317ede
- current_identifier: null
type: marketplace
value:
marketplace_plugin_unique_identifier: langgenius/gemini:0.2.7@b8a04c0155eb3b9d43ed1199b4387e7f67ef75ad63fcec466eab31a726e2c3a0
kind: app
version: 0.3.0
workflow:
conversation_variables: []
environment_variables: []
features:
file_upload:
allowed_file_extensions:
- .JPG
- .JPEG
- .PNG
- .GIF
- .WEBP
- .SVG
allowed_file_types:
- image
allowed_file_upload_methods:
- local_file
- remote_url
enabled: false
fileUploadConfig:
audio_file_size_limit: 50
batch_count_limit: 5
file_size_limit: 15
image_file_size_limit: 10
video_file_size_limit: 100
workflow_file_upload_limit: 10
image:
enabled: false
number_limits: 3
transfer_methods:
- local_file
- remote_url
number_limits: 3
opening_statement: ''
retriever_resource:
enabled: true
sensitive_word_avoidance:
enabled: false
speech_to_text:
enabled: false
suggested_questions: []
suggested_questions_after_answer:
enabled: false
text_to_speech:
enabled: false
language: ''
voice: ''
graph:
edges:
- data:
isInIteration: false
isInLoop: false
sourceType: start
targetType: template-transform
id: 1752646788391-source-1752651231563-target
selected: false
source: '1752646788391'
sourceHandle: source
target: '1752651231563'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
isInLoop: false
sourceType: template-transform
targetType: llm
id: 1752651466443-source-1752653558819-target
source: '1752651466443'
sourceHandle: source
target: '1752653558819'
targetHandle: target
type: custom
zIndex: 0
- data:
isInLoop: false
sourceType: template-transform
targetType: llm
id: 1752651231563-source-1752648440981-target
selected: false
source: '1752651231563'
sourceHandle: source
target: '1752648440981'
targetHandle: target
type: custom
zIndex: 0
- data:
isInLoop: false
sourceType: template-transform
targetType: end
id: 17526572823780-source-17526564523360-target
source: '17526572823780'
sourceHandle: source
target: '17526564523360'
targetHandle: target
type: custom
zIndex: 0
- data:
isInLoop: false
sourceType: llm
targetType: template-transform
id: 1752648440981-source-1752651466443-target
source: '1752648440981'
sourceHandle: source
target: '1752651466443'
targetHandle: target
type: custom
zIndex: 0
- data:
isInLoop: false
sourceType: llm
targetType: template-transform
id: 1752653558819-source-17526572823780-target
source: '1752653558819'
sourceHandle: source
target: '17526572823780'
targetHandle: target
type: custom
zIndex: 0
nodes:
- data:
desc: ''
selected: false
title: Start
type: start
variables:
- hide: false
label: original_language
max_length: null
options: []
required: false
type: text-input
variable: original_language
- label: output_language1
max_length: null
options: []
required: true
type: text-input
variable: output_language1
- label: the_doc
max_length: null
options: []
required: true
type: paragraph
variable: the_doc
- label: termbase
max_length: null
options: []
required: true
type: paragraph
variable: termbase
height: 166
id: '1752646788391'
position:
x: 30
y: 283
positionAbsolute:
x: 30
y: 283
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
context:
enabled: false
variable_selector: []
desc: ''
model:
completion_params:
max_output_tokens: 65501
temperature: 0.7
mode: chat
name: gemini-2.5-pro
provider: langgenius/gemini/google
prompt_template:
- id: a0469fc2-349e-4d84-939a-6733ec164785
role: system
text: ''
- id: f822745c-08cc-4d15-8534-848190d21d0d
role: user
text: '{{#1752651231563.output#}}'
retry_config:
max_retries: 3
retry_enabled: true
retry_interval: '2444'
selected: false
title: Translate 1
type: llm
variables: []
vision:
enabled: false
height: 117
id: '1752648440981'
position:
x: 636
y: 283
positionAbsolute:
x: 636
y: 283
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
desc: ''
selected: false
template: '# Role Definition
You are an expert technical translator specializing in software documentation.
Your specific task is to provide a precise, high-fidelity translation of
**MDX documentation files intended for the Mintlify platform**. You must
strictly adhere to a specific terminology glossary and preserve the complex
structure of MDX files.
***
# Context and Data
You will be provided with a mandatory terminology glossary and the source
MDX file content.
### Terminology Glossary
This glossary contains mandatory term-to-term translations. You MUST use
these translations exactly as provided.
------------
<termbase>
{{ termbase }}
</termbase>
------------
### Source Text (MDX Format)
This is the MDX content you need to translate from {{ original_language
}} to {{ output_language1 }}.
------------
<source_content>
{{ the_doc }}
</source_content>
------------
***
# Instructions and Rules
This is a comprehensive guide. Follow every rule meticulously.
### Rule 1: Mandatory Glossary Adherence
For any term found in the **Terminology Glossary**, you **MUST** use its
exact corresponding translation. There are no exceptions.
### Rule 2: MDX Structural Integrity
You must distinguish between content that requires translation and structures
that must be preserved.
#### A. WHAT TO TRANSLATE:
- **General Text**: All standard paragraph text.
- **Frontmatter `title`**: In the `---` block at the top of the file,
translate **only the value of the `title` field**.
- **Markdown Content**: Translate text within headings (`#`), lists (`-`,
`1.`), tables, blockquotes (`>`), bold (`**`), and italics (`*`).
- **Mintlify Component Content**: Translate the text content inside components
like `<Note>`, `<Warning>`, and `<Card>`.
- **Component Attributes**: Translate the string values of component attributes.
For example, in `<Card title="Related Resources">`, you must translate "Related
Resources".
#### B. WHAT TO PRESERVE (DO NOT TRANSLATE):
- **All Other Frontmatter Fields**: **Do not** translate the values of
other fields like `slug`, `description`, `icon`, etc., inside the `---`
block.
- **Code Blocks & Inline Code**: **Do not** translate any content inside
triple backticks (```` ``` ````) or single backticks (` `). This includes
code examples and commands.
- **Tags and Components**: **Do not** translate the names of MDX/JSX components
or HTML tags themselves (e.g., `<Note>`, `</Card>`, `<div>`).
- **Component Attribute Names**: **Do not** translate the names of attributes
(e.g., the word `title` in `title="..."`).
- **JSX-style Comments**: Preserve JSX comments exactly as they are: `{/*
This is a comment */}`.
- **Placeholders & Variables**: **Do not** translate any text inside placeholders
(e.g., `{{VARIABLE_NAME}}`, `%s`).
- **URLs and File Paths**: Preserve all URLs and file paths. In Markdown
links like `[display text](url)`, only translate the `display text`.
### Rule 3: Professional Translation Quality
For all translatable text not covered by the glossary, provide an accurate,
clear, and natural-sounding translation appropriate for a professional,
technical audience in {{ output_language1 }}.
***
# Task Execution
Proceed with the translation of the **Source Text** from **{{ original_language
}}** to **{{ output_language1 }}**.
Ensure your output strictly follows all rules defined above, paying special
attention to these critical requirements:
- **Mandatory Glossary Usage**
- **MDX Frontmatter & Component Integrity**
- **Preservation of Code and Placeholders**
- **Output content directly, do not use any wrapper such as ''```mdx'' **
Provide only the final, translated MDX text as your response.
'
title: Translate prompt 1
type: template-transform
variables:
- value_selector:
- '1752646788391'
- original_language
variable: original_language
- value_selector:
- '1752646788391'
- output_language1
variable: output_language1
- value_selector:
- '1752646788391'
- termbase
variable: termbase
- value_selector:
- '1752646788391'
- the_doc
variable: the_doc
height: 52
id: '1752651231563'
position:
x: 333
y: 283
positionAbsolute:
x: 333
y: 283
selected: true
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
desc: ''
selected: false
template: '<termbase>
{{ termbase }}
</termbase>
------------
------------
<source_content>
{{ the_doc }}
</source_content>
------------
------------
<translated_content>
{{ text }}
</translated_content>
'
title: Check prompt 1
type: template-transform
variables:
- value_selector:
- '1752646788391'
- the_doc
variable: the_doc
- value_selector:
- '1752646788391'
- termbase
variable: termbase
- value_selector:
- '1752648440981'
- text
variable: text
height: 52
id: '1752651466443'
position:
x: 939
y: 283
positionAbsolute:
x: 939
y: 283
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
context:
enabled: false
variable_selector: []
default_value:
- key: text
type: string
value: CheckFail
desc: ''
error_strategy: default-value
model:
completion_params: {}
mode: chat
name: gpt-4o-mini
provider: langgenius/openai/openai
prompt_template:
- id: f2c1bc20-e35f-409e-9d17-bd75217f7edb
role: system
text: ''
- id: a1253770-1afc-4367-841f-22c735b5f0d9
role: user
text: "# Role Definition\nYou are an AI Quality Assurance agent, specializing\
\ in meticulously auditing translated technical MDX documents.\n\n# Context\n\
You will be provided with three pieces of information:\n1. `<termbase>`:\
\ A mandatory glossary of terms.\n2. `<source_content>`: The original\
\ document before translation.\n3. `<translated_content>`: The final\
\ translated document that you must audit.\n\n{{#1752651466443.output#}}\n\
\n# Audit Instructions\nYour task is to compare the `<translated_content>`\
\ against the `<source_content>`, strictly following the rules below.\
\ Your goal is to identify any deviations or errors in the translation.\n\
\n1. **Glossary Adherence**: Verify that every term from the `<termbase>`\
\ was translated exactly as specified in the `<translated_content>`.\n\
2. **Structural Integrity**: Confirm that the MDX structure is perfectly\
\ preserved.\n - **Frontmatter**: Check that ONLY the `title` field\
\ was translated. All other fields (`slug`, `description`, `icon`, etc.)\
\ must be untouched.\n - **Code & Placeholders**: Ensure that all\
\ content inside code blocks (```` ``` ````), inline code (` `), and placeholders\
\ (`{{...}}`) is completely untranslated.\n - **Components & Tags**:\
\ Verify that all MDX/HTML tags (e.g., `<Note>`, `</Card>`) and JSX comments\
\ (`{/*...* /}`) are preserved without modification.\n3. **Translation\
\ Quality**: Assess if the general, non-glossary text in `<translated_content>`\
\ is accurate, fluent, and professional, without grammatical errors, when\
\ compared to the `<source_content>`.\n\n# Output Specification\nYour\
\ output must contain exactly two parts: `result` and `reason`.\n\n1.\
\ **`result`**:\n Provide the final verdict. The `result` **must be\
\ one of these three exact values**:\n - `Perfect`\n - `Approved\
\ with Minor Issues`\n - `Requires Human Review`\n\n2. **`reason`**:\n\
\ Provide a concise but detailed explanation for your verdict.\n \
\ - If the result is `Perfect`, state that all checks passed.\n \
\ - If you find any errors (`Approved with Minor Issues` or `Requires\
\ Human Review`), you **MUST cite specific examples** from the text to\
\ support your findings. For instance, point out the incorrect term, the\
\ translated code, or the awkward sentence.\n\n# Task Execution\nAnalyze\
\ the provided content now and generate your response in the specified\
\ two-part format."
selected: false
structured_output:
schema:
properties:
reason:
description: Provide a concise but detailed explanation for your verdict. - If
the result is `Perfect`, state that all checks passed. - If
you find any errors (`Approved with Minor Issues` or `Requires Human
Review`), you **MUST cite specific examples** from the text to support
your findings. For instance, point out the incorrect term, the translated
code, or the awkward sentence.
maxLength: 500
type: string
result:
description: ' Provide the final verdict. The `result` **must be
one of these three exact values**: - `Perfect` - `Approved
with Minor Issues` - `Requires Human Review`'
enum:
- Perfect
- ApprovedwithMinorIssues
- RequiresHumanReview
type: string
required:
- result
- reason
type: object
structured_output_enabled: true
title: Check 1
type: llm
variables: []
vision:
enabled: false
height: 124
id: '1752653558819'
position:
x: 1242
y: 283
positionAbsolute:
x: 1242
y: 283
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
desc: ''
outputs:
- value_selector:
- '1752648440981'
- text
value_type: string
variable: output1
- value_selector:
- '17526572823780'
- output
value_type: string
variable: result_summary
selected: false
title: End (1)
type: end
height: 114
id: '17526564523360'
position:
x: 1848
y: 283
positionAbsolute:
x: 1848
y: 283
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
desc: ''
selected: false
template: 'Translate results: {{ output_language1 }} - {{ result }}.
See the Dify log for details if needed.'
title: Check Result 1
type: template-transform
variables:
- value_selector:
- '1752646788391'
- output_language1
variable: output_language1
- value_selector:
- '1752653558819'
- structured_output
- result
variable: result
height: 52
id: '17526572823780'
position:
x: 1545
y: 283
positionAbsolute:
x: 1545
y: 283
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
viewport:
x: 268
y: 99
zoom: 0.7