New: a new interpretor based on Andrew Ng theory. (#3532)

### What problem does this PR solve?

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
Kevin Hu 2024-11-20 18:21:50 +08:00 committed by Yingfeng Zhang
parent 541272eb99
commit 362db857d0
6 changed files with 604 additions and 275 deletions

View File

@ -199,7 +199,7 @@ class Canvas(ABC):
if any([cc not in self.path[-1] for cc in cpids]):
if c not in waiting: waiting.append(c)
continue
yield "'{}' is running...".format(self.get_compnent_name(c))
yield "*'{}'* is running...🕞".format(self.get_compnent_name(c))
ans = cpn.run(self.history, **kwargs)
self.path[-1].append(c)
ran += 1
@ -224,28 +224,16 @@ class Canvas(ABC):
for m in prepare2run([switch_out]):
yield {"content": m, "running_status": True}
except Exception as e:
for p in [c for p in self.path for c in p][::-1]:
if p.lower().find("answer") >= 0:
self.get_component(p)["obj"].set_exception(e)
for m in prepare2run([p]):
yield {"content": m, "running_status": True}
break
yield {"content": "*Exception*: {}".format(e), "running_status": True}
logging.exception("Canvas.run got exception")
break
continue
try:
for m in prepare2run(cpn["downstream"]):
yield {"content": m, "running_status": True}
except Exception as e:
for p in [c for p in self.path for c in p][::-1]:
if p.lower().find("answer") >= 0:
self.get_component(p)["obj"].set_exception(e)
for m in prepare2run([p]):
yield {"content": m, "running_status": True}
break
yield {"content": "*Exception*: {}".format(e), "running_status": True}
logging.exception("Canvas.run got exception")
break
if ran >= len(self.path[-1]) and waiting:
without_dependent_checking = waiting

View File

@ -454,7 +454,7 @@ class ComponentBase(ABC):
outs = []
for q in self._param.query:
if q["component_id"]:
if q["component_id"].split("@")[0].lower().find("begin") > 0:
if q["component_id"].split("@")[0].lower().find("begin") >= 0:
cpn_id, key = q["component_id"].split("@")
for p in self._canvas.get_component(cpn_id)["obj"]._param.query:
if p["key"] == key:

View File

@ -124,11 +124,16 @@ class Generate(ComponentBase):
cpn = self._canvas.get_component(component_id)["obj"]
if cpn.component_name.lower() == "answer":
kwargs[para["key"]] = self._canvas.get_history(1)[0]["content"]
hist = self._canvas.get_history(1)
if hist:
hist = hist[0]["content"]
else:
hist = ""
kwargs[para["key"]] = hist
continue
_, out = cpn.output(allow_partial=False)
if "content" not in out.columns:
kwargs[para["key"]] = "Nothing"
kwargs[para["key"]] = ""
else:
if cpn.component_name.lower() == "retrieval":
retrieval_res.append(out)

View File

@ -6,139 +6,380 @@
"dsl": {
"answer": [],
"components": {
"begin": {
"obj": {
"component_name": "Begin",
"params": {
"prologue": "Hi there! Please enter the text you want to translate in format like: 'text you want to translate' => target language. For an example: 您好! => English"
}
},
"downstream": [
"Answer:ShortPapersShake"
],
"upstream": []
},
"Answer:ShortPapersShake": {
"Answer:TinyGamesGuess": {
"downstream": [],
"obj": {
"component_name": "Answer",
"params": {}
"params": {
"inputs": [],
"message_history_window_size": 22,
"output": {
"content": "# Putin Approves New Russian Nuclear Deterrence Policy, China Responds\n\nDuring a regular press conference on November 20th, a reporter asked about two significant events: Russian President Vladimir Putin's approval of the new basic policy on Russia's nuclear deterrence, and the subsequent missile attack by Ukrainian forces on the Bryansk region of Russia. The reporter asked for China's position on these developments.\n\nOn November 19th, President Putin signed a decree approving the updated policy for Russia's nuclear deterrence. The document states that Russia views nuclear weapons as a means of deterrence and that their use would be an extreme measure taken under compulsion. On the same day, the Bryansk region was targeted by six U.S.-made missiles launched by Ukrainian forces. According to a report from the Russian Defense Ministry, all six missiles were intercepted by Russia's air defense systems, with debris falling within a military area in Bryansk.\n\nIn response to these events, Chinese Foreign Ministry spokesperson Lin Jian stated that we have noted the relevant reports. In the current context, all parties should remain calm and restrained, engaging in dialogue and consultation to jointly promote de-escalation and reduce strategic risks.\n\nLin emphasized that China's position on the Ukraine issue has been consistent and clear. China hopes that all parties will work towards easing tensions and pursuing political resolution of the Ukraine crisis. China remains committed to playing a constructive role in this regard.",
"reference": []
},
"output_var_name": "output",
"post_answers": [],
"query": []
}
},
"downstream": [
"Generate:HeavyForksTell"
],
"upstream": [
"begin",
"Generate:HeavyForksTell"
"Generate:ChubbyCougarsRush"
]
},
"Generate:HeavyForksTell": {
"Generate:ChubbyCougarsRush": {
"downstream": [
"Answer:TinyGamesGuess"
],
"obj": {
"component_name": "Generate",
"params": {
"cite": true,
"cite": false,
"frequency_penalty": 0.7,
"inputs": [
{
"component_id": "begin@lang",
"content": "English"
},
{
"component_id": "begin@file",
"content": "https://www.sohu.com/a/828560323_162522?edtsign=70AF5B785A09DF20C126EABC2EC4FB4ABA309622&edtcode=2PBU%2BTiMwCHq%2FwmFSXvzFA%3D%3D&scm=10001.663_14-200000.0.10006.&_f=index_cpc_1_0&spm=smpc.channel_258.block4_314_Y6ubu8_1_fd.11.1732094805514oPmAsKj_1090\n\u666e\u4eac\u6279\u51c6\u65b0\u7248\u4fc4\u6838\u5a01\u6151\u56fd\u5bb6\u57fa\u672c\u653f\u7b56\uff0c\u5916\u4ea4\u90e8\u56de\u5e94_\u5e03\u826f\u65af_\u7f8e\u5236_\u4e2d\u65b9\n\u3010\u73af\u7403\u65f6\u62a5-\u73af\u7403\u7f51\u62a5\u9053 \u8bb0\u8005 \u767d\u4e91\u6021\u3011\u572811\u670820\u65e5\u5916\u4ea4\u90e8\u4f8b\u884c\u8bb0\u8005\u4f1a\u4e0a\uff0c\u6709\u8bb0\u8005\u63d0\u95ee\u79f0\uff0c\u4fc4\u7f57\u65af\u603b\u7edf\u666e\u4eac19\u65e5\u7b7e\u7f72\u603b\u7edf\u4ee4\uff0c\u6279\u51c6\u65b0\u7248\u4fc4\u7f57\u65af\u6838\u5a01\u6151\u56fd\u5bb6\u57fa\u672c\u653f\u7b56\u3002\u6587\u4ef6\u79f0\uff0c\u4fc4\u7f57\u65af\u89c6\u6838\u6b66\u5668\u4e3a\u4e00\u79cd\u5a01\u6151\u624b\u6bb5\uff0c\u4f7f\u7528\u6838\u6b66\u5668\u662f\u6781\u7aef\u60c5\u51b5\u4e0b\u88ab\u8feb\u91c7\u53d6\u7684\u63aa\u65bd\u3002\u540c\u65e5\uff0c\u4fc4\u5e03\u826f\u65af\u514b\u5dde\u906d\u5230\u4e4c\u519b6\u679a\u7f8e\u5236\u5bfc\u5f39\u88ad\u51fb\u3002\u4fc4\u56fd\u9632\u90e8\u7684\u901a\u62a5\u79f0\uff0c\u7ecf\u786e\u8ba4\uff0c\u4e4c\u65b9\u4f7f\u7528\u7684\u662f\u7f8e\u5236\u9646\u519b\u6218\u672f\u5bfc\u5f39\u7cfb\u7edf\uff0c6\u679a\u5bfc\u5f39\u5168\u90e8\u88ab\u4fc4\u519b\u9632\u7a7a\u7cfb\u7edf\u62e6\u622a\uff0c\u5bfc\u5f39\u6b8b\u7247\u843d\u5165\u5e03\u826f\u65af\u514b\u5dde\u4e00\u5904\u519b\u4e8b\u533a\u57df\u5185\u3002\u4e2d\u65b9\u5bf9\u8fd9\u4e24\u4ef6\u4e8b\u60c5\u6709\u4f55\u8bc4\u8bba\uff1f\n\n\u5bf9\u6b64\uff0c\u4e2d\u56fd\u5916\u4ea4\u90e8\u53d1\u8a00\u4eba\u6797\u5251\u8868\u793a\uff0c\u6211\u4eec\u6ce8\u610f\u5230\u4e86\u6709\u5173\u62a5\u9053\u3002\u5f53\u524d\u5f62\u52bf\u4e0b\uff0c\u5404\u65b9\u5e94\u5f53\u4fdd\u6301\u51b7\u9759\u514b\u5236\uff0c\u901a\u8fc7\u5bf9\u8bdd\u534f\u5546\u5171\u540c\u63a8\u52a8\u5c40\u52bf\u7f13\u548c\uff0c\u51cf\u5c11\u6218\u7565\u98ce\u9669\u3002\n\n\u6797\u5251\u5f3a\u8c03\uff0c\u5728\u4e4c\u514b\u5170\u95ee\u9898\u4e0a\uff0c\u4e2d\u65b9\u7684\u7acb\u573a\u662f\u4e00\u8d2f\u7684\u3001\u660e\u786e\u7684\u3002\u4e2d\u65b9\u5e0c\u671b\u5404\u65b9\u63a8\u52a8\u7f13\u548c\u5c40\u52bf\u3001\u81f4\u529b\u4e8e\u653f\u6cbb\u89e3\u51b3\u4e4c\u514b\u5170\u5371\u673a\u7684\u7acb\u573a\u6ca1\u6709\u6539\u53d8\uff0c\u5e76\u5c06\u7ee7\u7eed\u4e3a\u6b64\u53d1\u6325\u5efa\u8bbe\u6027\u4f5c\u7528\u3002 \u8fd4\u56de\u641c\u72d0\uff0c\u67e5\u770b\u66f4\u591a\n\n\u8d23\u4efb\u7f16\u8f91\uff1a \u6bb7\u745e\u6c11 UN949\n----\n"
},
{
"component_id": "Generate:RichWordsDeny",
"content": " - # Putin Approves New Russian Nuclear Deterrence Policy, China Responds\n\nIn a recent routine press conference on November 20th, a reporter inquired about two significant events: Russian President Vladimir Putin's approval of the new basic policy on Russia's nuclear deterrence, and the subsequent missile attack by Ukrainian forces on the Bryansk region of Russia. The reporter sought China's stance on these developments.\n\nOn November 19th, President Putin signed a decree approving the updated policy for Russia's nuclear deterrence. The document states that Russia views nuclear weapons as a means of deterrence and that their use would be an extreme measure taken under compulsion. On the same day, the Bryansk region was targeted by six U.S.-made missiles launched by Ukrainian forces. According to a report from the Russian Defense Ministry, all six missiles were intercepted by Russia's air defense systems, with debris falling within a military area in Bryansk.\n\nIn response to these events, Chinese Foreign Ministry spokesperson Lin Jian stated that China has taken note of the relevant reports. In the current context, all parties should remain calm and restrained, engaging in dialogue and consultation to jointly promote de-escalation and reduce strategic risks.\n\nLin emphasized that China's position on the Ukraine issue has been consistent and clear. China hopes that all parties will work towards easing tensions and pursuing political resolution of the Ukraine crisis. China remains committed to playing a constructive role in this regard."
},
{
"component_id": "Generate:SlimyFrogsArgue",
"content": " - 1. **Accuracy**: The translation incorrectly states \"Chinese Foreign Ministry spokesperson Lin Jian\" instead of \"Chinese Foreign Ministry spokesperson Lin Jian.\" The correct name is \"Lin Jian,\" not \"Lin Jian.\"\n\n2. **Fluency**: The phrase \"In a recent routine press conference on November 20th, a reporter inquired about two significant events\" can be more fluently translated as \"During a regular press conference on November 20th, a reporter asked about two significant events.\"\n\n3. **Fluency**: The sentence \"The reporter sought China's stance on these developments\" can be improved to read more naturally: \"The reporter asked for China's position on these developments.\"\n\n4. **Style**: The phrase \"China has taken note of the relevant reports\" could be more stylistically aligned with the source text by using: \"We have noted the relevant reports.\"\n\n5. **Terminology**: The term \"Bryansk region\" should be consistently used throughout the translation instead of switching between \"Bryansk region\" and \"Bryansk.\""
}
],
"llm_id": "deepseek-chat@DeepSeek",
"max_tokens": 256,
"max_tokens": 0,
"message_history_window_size": 12,
"parameters": [],
"output": {
"content": "# Putin Approves New Russian Nuclear Deterrence Policy, China Responds\n\nDuring a regular press conference on November 20th, a reporter asked about two significant events: Russian President Vladimir Putin's approval of the new basic policy on Russia's nuclear deterrence, and the subsequent missile attack by Ukrainian forces on the Bryansk region of Russia. The reporter asked for China's position on these developments.\n\nOn November 19th, President Putin signed a decree approving the updated policy for Russia's nuclear deterrence. The document states that Russia views nuclear weapons as a means of deterrence and that their use would be an extreme measure taken under compulsion. On the same day, the Bryansk region was targeted by six U.S.-made missiles launched by Ukrainian forces. According to a report from the Russian Defense Ministry, all six missiles were intercepted by Russia's air defense systems, with debris falling within a military area in Bryansk.\n\nIn response to these events, Chinese Foreign Ministry spokesperson Lin Jian stated that we have noted the relevant reports. In the current context, all parties should remain calm and restrained, engaging in dialogue and consultation to jointly promote de-escalation and reduce strategic risks.\n\nLin emphasized that China's position on the Ukraine issue has been consistent and clear. China hopes that all parties will work towards easing tensions and pursuing political resolution of the Ukraine crisis. China remains committed to playing a constructive role in this regard.",
"reference": []
},
"output_var_name": "output",
"parameters": [
{
"component_id": "begin@lang",
"id": "73f48a67-b78f-4bcd-8326-a83c31073ab9",
"key": "target_lang"
},
{
"component_id": "begin@file",
"id": "c9142975-25b3-4199-8fce-aa0bc29a31f2",
"key": "source_text"
},
{
"component_id": "Generate:RichWordsDeny",
"id": "6c824b2a-fe3b-4336-95b5-e85f676bef39",
"key": "translation_1"
},
{
"component_id": "Generate:SlimyFrogsArgue",
"id": "f3bd4569-4852-43fa-b80a-e0dd27dd9e1c",
"key": "reflection"
}
],
"presence_penalty": 0.4,
"prompt": "You are an professional interpreter.\n- Role: an professional interpreter.\n- Input format: content need to be translated => target language. \n- Answer format: => translated content in target language. \n- Examples:\n - user: 您好! => English. assistant: => How are you doing!\n - user: You look good today. => Japanese. assistant: => 今日は調子がいいですね 。\n",
"prompt": "Your task is to carefully read, then edit, a translation to {target_lang}, taking into\naccount a list of expert suggestions and constructive criticisms.\n\nThe source text, the initial translation, and the expert linguist suggestions are delimited by XML tags <SOURCE_TEXT></SOURCE_TEXT>, <TRANSLATION></TRANSLATION> and <EXPERT_SUGGESTIONS></EXPERT_SUGGESTIONS> \\\nas follows:\n\n<SOURCE_TEXT>\n{source_text}\n</SOURCE_TEXT>\n\n<TRANSLATION>\n{translation_1}\n</TRANSLATION>\n\n<EXPERT_SUGGESTIONS>\n{reflection}\n</EXPERT_SUGGESTIONS>\n\nPlease take into account the expert suggestions when editing the translation. Edit the translation by ensuring:\n\n(i) accuracy (by correcting errors of addition, mistranslation, omission, or untranslated text),\n(ii) fluency (by applying {target_lang} grammar, spelling and punctuation rules and ensuring there are no unnecessary repetitions), \n(iii) style (by ensuring the translations reflect the style of the source text)\n(iv) terminology (inappropriate for context, inconsistent use), or\n(v) other errors.\n\nOutput only the new translation and nothing else.",
"query": [],
"temperature": 0.1,
"top_p": 0.3
}
},
"downstream": [
"Answer:ShortPapersShake"
],
"upstream": [
"Answer:ShortPapersShake"
"Generate:SlimyFrogsArgue"
]
},
"Generate:RichWordsDeny": {
"downstream": [
"Generate:SlimyFrogsArgue"
],
"obj": {
"component_name": "Generate",
"params": {
"cite": false,
"frequency_penalty": 0.7,
"inputs": [
{
"component_id": "begin@lang",
"content": "English"
},
{
"component_id": "begin@file",
"content": "https://www.sohu.com/a/828560323_162522?edtsign=70AF5B785A09DF20C126EABC2EC4FB4ABA309622&edtcode=2PBU%2BTiMwCHq%2FwmFSXvzFA%3D%3D&scm=10001.663_14-200000.0.10006.&_f=index_cpc_1_0&spm=smpc.channel_258.block4_314_Y6ubu8_1_fd.11.1732094805514oPmAsKj_1090\n\u666e\u4eac\u6279\u51c6\u65b0\u7248\u4fc4\u6838\u5a01\u6151\u56fd\u5bb6\u57fa\u672c\u653f\u7b56\uff0c\u5916\u4ea4\u90e8\u56de\u5e94_\u5e03\u826f\u65af_\u7f8e\u5236_\u4e2d\u65b9\n\u3010\u73af\u7403\u65f6\u62a5-\u73af\u7403\u7f51\u62a5\u9053 \u8bb0\u8005 \u767d\u4e91\u6021\u3011\u572811\u670820\u65e5\u5916\u4ea4\u90e8\u4f8b\u884c\u8bb0\u8005\u4f1a\u4e0a\uff0c\u6709\u8bb0\u8005\u63d0\u95ee\u79f0\uff0c\u4fc4\u7f57\u65af\u603b\u7edf\u666e\u4eac19\u65e5\u7b7e\u7f72\u603b\u7edf\u4ee4\uff0c\u6279\u51c6\u65b0\u7248\u4fc4\u7f57\u65af\u6838\u5a01\u6151\u56fd\u5bb6\u57fa\u672c\u653f\u7b56\u3002\u6587\u4ef6\u79f0\uff0c\u4fc4\u7f57\u65af\u89c6\u6838\u6b66\u5668\u4e3a\u4e00\u79cd\u5a01\u6151\u624b\u6bb5\uff0c\u4f7f\u7528\u6838\u6b66\u5668\u662f\u6781\u7aef\u60c5\u51b5\u4e0b\u88ab\u8feb\u91c7\u53d6\u7684\u63aa\u65bd\u3002\u540c\u65e5\uff0c\u4fc4\u5e03\u826f\u65af\u514b\u5dde\u906d\u5230\u4e4c\u519b6\u679a\u7f8e\u5236\u5bfc\u5f39\u88ad\u51fb\u3002\u4fc4\u56fd\u9632\u90e8\u7684\u901a\u62a5\u79f0\uff0c\u7ecf\u786e\u8ba4\uff0c\u4e4c\u65b9\u4f7f\u7528\u7684\u662f\u7f8e\u5236\u9646\u519b\u6218\u672f\u5bfc\u5f39\u7cfb\u7edf\uff0c6\u679a\u5bfc\u5f39\u5168\u90e8\u88ab\u4fc4\u519b\u9632\u7a7a\u7cfb\u7edf\u62e6\u622a\uff0c\u5bfc\u5f39\u6b8b\u7247\u843d\u5165\u5e03\u826f\u65af\u514b\u5dde\u4e00\u5904\u519b\u4e8b\u533a\u57df\u5185\u3002\u4e2d\u65b9\u5bf9\u8fd9\u4e24\u4ef6\u4e8b\u60c5\u6709\u4f55\u8bc4\u8bba\uff1f\n\n\u5bf9\u6b64\uff0c\u4e2d\u56fd\u5916\u4ea4\u90e8\u53d1\u8a00\u4eba\u6797\u5251\u8868\u793a\uff0c\u6211\u4eec\u6ce8\u610f\u5230\u4e86\u6709\u5173\u62a5\u9053\u3002\u5f53\u524d\u5f62\u52bf\u4e0b\uff0c\u5404\u65b9\u5e94\u5f53\u4fdd\u6301\u51b7\u9759\u514b\u5236\uff0c\u901a\u8fc7\u5bf9\u8bdd\u534f\u5546\u5171\u540c\u63a8\u52a8\u5c40\u52bf\u7f13\u548c\uff0c\u51cf\u5c11\u6218\u7565\u98ce\u9669\u3002\n\n\u6797\u5251\u5f3a\u8c03\uff0c\u5728\u4e4c\u514b\u5170\u95ee\u9898\u4e0a\uff0c\u4e2d\u65b9\u7684\u7acb\u573a\u662f\u4e00\u8d2f\u7684\u3001\u660e\u786e\u7684\u3002\u4e2d\u65b9\u5e0c\u671b\u5404\u65b9\u63a8\u52a8\u7f13\u548c\u5c40\u52bf\u3001\u81f4\u529b\u4e8e\u653f\u6cbb\u89e3\u51b3\u4e4c\u514b\u5170\u5371\u673a\u7684\u7acb\u573a\u6ca1\u6709\u6539\u53d8\uff0c\u5e76\u5c06\u7ee7\u7eed\u4e3a\u6b64\u53d1\u6325\u5efa\u8bbe\u6027\u4f5c\u7528\u3002 \u8fd4\u56de\u641c\u72d0\uff0c\u67e5\u770b\u66f4\u591a\n\n\u8d23\u4efb\u7f16\u8f91\uff1a \u6bb7\u745e\u6c11 UN949\n----\n"
}
],
"llm_id": "deepseek-chat@DeepSeek",
"max_tokens": 0,
"message_history_window_size": 12,
"output": {
"content": {
"0": "# Putin Approves New Russian Nuclear Deterrence Policy, China Responds\n\nIn a recent routine press conference on November 20th, a reporter inquired about two significant events: Russian President Vladimir Putin's approval of the new basic policy on Russia's nuclear deterrence, and the subsequent missile attack by Ukrainian forces on the Bryansk region of Russia. The reporter sought China's stance on these developments.\n\nOn November 19th, President Putin signed a decree approving the updated policy for Russia's nuclear deterrence. The document states that Russia views nuclear weapons as a means of deterrence and that their use would be an extreme measure taken under compulsion. On the same day, the Bryansk region was targeted by six U.S.-made missiles launched by Ukrainian forces. According to a report from the Russian Defense Ministry, all six missiles were intercepted by Russia's air defense systems, with debris falling within a military area in Bryansk.\n\nIn response to these events, Chinese Foreign Ministry spokesperson Lin Jian stated that China has taken note of the relevant reports. In the current context, all parties should remain calm and restrained, engaging in dialogue and consultation to jointly promote de-escalation and reduce strategic risks.\n\nLin emphasized that China's position on the Ukraine issue has been consistent and clear. China hopes that all parties will work towards easing tensions and pursuing political resolution of the Ukraine crisis. China remains committed to playing a constructive role in this regard."
}
},
"output_var_name": "output",
"parameters": [
{
"component_id": "begin@lang",
"id": "a36e78fb-b431-4ae6-afa8-77839587fcf8",
"key": "lang"
},
{
"component_id": "begin@file",
"id": "f8a704b7-693b-4480-aa9a-da4a83250059",
"key": "file"
}
],
"presence_penalty": 0.4,
"prompt": "Role: You are a professional translator proficient in {lang}, with an exceptional ability to convert specialized academic papers into accessible popular science articles. Please assist me in translating the following paragraph into {lang}, ensuring that its style resembles that of popular science articles in {lang}.\n\nRequirements & Restrictions:\n - Use Markdown format to output.\n - DO NOT overlook any details.\n\n\n<ORIGINAL_TEXT>\n{file}\n\n<TRANSLATED_TEXT>",
"query": [],
"temperature": 0.1,
"top_p": 0.3
}
},
"upstream": [
"begin"
]
},
"Generate:SlimyFrogsArgue": {
"downstream": [
"Generate:ChubbyCougarsRush"
],
"obj": {
"component_name": "Generate",
"params": {
"cite": false,
"frequency_penalty": 0.7,
"inputs": [
{
"component_id": "begin@lang",
"content": "English"
},
{
"component_id": "begin@file",
"content": "https://www.sohu.com/a/828560323_162522?edtsign=70AF5B785A09DF20C126EABC2EC4FB4ABA309622&edtcode=2PBU%2BTiMwCHq%2FwmFSXvzFA%3D%3D&scm=10001.663_14-200000.0.10006.&_f=index_cpc_1_0&spm=smpc.channel_258.block4_314_Y6ubu8_1_fd.11.1732094805514oPmAsKj_1090\n\u666e\u4eac\u6279\u51c6\u65b0\u7248\u4fc4\u6838\u5a01\u6151\u56fd\u5bb6\u57fa\u672c\u653f\u7b56\uff0c\u5916\u4ea4\u90e8\u56de\u5e94_\u5e03\u826f\u65af_\u7f8e\u5236_\u4e2d\u65b9\n\u3010\u73af\u7403\u65f6\u62a5-\u73af\u7403\u7f51\u62a5\u9053 \u8bb0\u8005 \u767d\u4e91\u6021\u3011\u572811\u670820\u65e5\u5916\u4ea4\u90e8\u4f8b\u884c\u8bb0\u8005\u4f1a\u4e0a\uff0c\u6709\u8bb0\u8005\u63d0\u95ee\u79f0\uff0c\u4fc4\u7f57\u65af\u603b\u7edf\u666e\u4eac19\u65e5\u7b7e\u7f72\u603b\u7edf\u4ee4\uff0c\u6279\u51c6\u65b0\u7248\u4fc4\u7f57\u65af\u6838\u5a01\u6151\u56fd\u5bb6\u57fa\u672c\u653f\u7b56\u3002\u6587\u4ef6\u79f0\uff0c\u4fc4\u7f57\u65af\u89c6\u6838\u6b66\u5668\u4e3a\u4e00\u79cd\u5a01\u6151\u624b\u6bb5\uff0c\u4f7f\u7528\u6838\u6b66\u5668\u662f\u6781\u7aef\u60c5\u51b5\u4e0b\u88ab\u8feb\u91c7\u53d6\u7684\u63aa\u65bd\u3002\u540c\u65e5\uff0c\u4fc4\u5e03\u826f\u65af\u514b\u5dde\u906d\u5230\u4e4c\u519b6\u679a\u7f8e\u5236\u5bfc\u5f39\u88ad\u51fb\u3002\u4fc4\u56fd\u9632\u90e8\u7684\u901a\u62a5\u79f0\uff0c\u7ecf\u786e\u8ba4\uff0c\u4e4c\u65b9\u4f7f\u7528\u7684\u662f\u7f8e\u5236\u9646\u519b\u6218\u672f\u5bfc\u5f39\u7cfb\u7edf\uff0c6\u679a\u5bfc\u5f39\u5168\u90e8\u88ab\u4fc4\u519b\u9632\u7a7a\u7cfb\u7edf\u62e6\u622a\uff0c\u5bfc\u5f39\u6b8b\u7247\u843d\u5165\u5e03\u826f\u65af\u514b\u5dde\u4e00\u5904\u519b\u4e8b\u533a\u57df\u5185\u3002\u4e2d\u65b9\u5bf9\u8fd9\u4e24\u4ef6\u4e8b\u60c5\u6709\u4f55\u8bc4\u8bba\uff1f\n\n\u5bf9\u6b64\uff0c\u4e2d\u56fd\u5916\u4ea4\u90e8\u53d1\u8a00\u4eba\u6797\u5251\u8868\u793a\uff0c\u6211\u4eec\u6ce8\u610f\u5230\u4e86\u6709\u5173\u62a5\u9053\u3002\u5f53\u524d\u5f62\u52bf\u4e0b\uff0c\u5404\u65b9\u5e94\u5f53\u4fdd\u6301\u51b7\u9759\u514b\u5236\uff0c\u901a\u8fc7\u5bf9\u8bdd\u534f\u5546\u5171\u540c\u63a8\u52a8\u5c40\u52bf\u7f13\u548c\uff0c\u51cf\u5c11\u6218\u7565\u98ce\u9669\u3002\n\n\u6797\u5251\u5f3a\u8c03\uff0c\u5728\u4e4c\u514b\u5170\u95ee\u9898\u4e0a\uff0c\u4e2d\u65b9\u7684\u7acb\u573a\u662f\u4e00\u8d2f\u7684\u3001\u660e\u786e\u7684\u3002\u4e2d\u65b9\u5e0c\u671b\u5404\u65b9\u63a8\u52a8\u7f13\u548c\u5c40\u52bf\u3001\u81f4\u529b\u4e8e\u653f\u6cbb\u89e3\u51b3\u4e4c\u514b\u5170\u5371\u673a\u7684\u7acb\u573a\u6ca1\u6709\u6539\u53d8\uff0c\u5e76\u5c06\u7ee7\u7eed\u4e3a\u6b64\u53d1\u6325\u5efa\u8bbe\u6027\u4f5c\u7528\u3002 \u8fd4\u56de\u641c\u72d0\uff0c\u67e5\u770b\u66f4\u591a\n\n\u8d23\u4efb\u7f16\u8f91\uff1a \u6bb7\u745e\u6c11 UN949\n----\n"
},
{
"component_id": "Generate:RichWordsDeny",
"content": " - # Putin Approves New Russian Nuclear Deterrence Policy, China Responds\n\nIn a recent routine press conference on November 20th, a reporter inquired about two significant events: Russian President Vladimir Putin's approval of the new basic policy on Russia's nuclear deterrence, and the subsequent missile attack by Ukrainian forces on the Bryansk region of Russia. The reporter sought China's stance on these developments.\n\nOn November 19th, President Putin signed a decree approving the updated policy for Russia's nuclear deterrence. The document states that Russia views nuclear weapons as a means of deterrence and that their use would be an extreme measure taken under compulsion. On the same day, the Bryansk region was targeted by six U.S.-made missiles launched by Ukrainian forces. According to a report from the Russian Defense Ministry, all six missiles were intercepted by Russia's air defense systems, with debris falling within a military area in Bryansk.\n\nIn response to these events, Chinese Foreign Ministry spokesperson Lin Jian stated that China has taken note of the relevant reports. In the current context, all parties should remain calm and restrained, engaging in dialogue and consultation to jointly promote de-escalation and reduce strategic risks.\n\nLin emphasized that China's position on the Ukraine issue has been consistent and clear. China hopes that all parties will work towards easing tensions and pursuing political resolution of the Ukraine crisis. China remains committed to playing a constructive role in this regard."
}
],
"llm_id": "deepseek-chat@DeepSeek",
"max_tokens": 0,
"message_history_window_size": 12,
"output": {
"content": {
"0": "1. **Accuracy**: The translation incorrectly states \"Chinese Foreign Ministry spokesperson Lin Jian\" instead of \"Chinese Foreign Ministry spokesperson Lin Jian.\" The correct name is \"Lin Jian,\" not \"Lin Jian.\"\n\n2. **Fluency**: The phrase \"In a recent routine press conference on November 20th, a reporter inquired about two significant events\" can be more fluently translated as \"During a regular press conference on November 20th, a reporter asked about two significant events.\"\n\n3. **Fluency**: The sentence \"The reporter sought China's stance on these developments\" can be improved to read more naturally: \"The reporter asked for China's position on these developments.\"\n\n4. **Style**: The phrase \"China has taken note of the relevant reports\" could be more stylistically aligned with the source text by using: \"We have noted the relevant reports.\"\n\n5. **Terminology**: The term \"Bryansk region\" should be consistently used throughout the translation instead of switching between \"Bryansk region\" and \"Bryansk.\""
}
},
"output_var_name": "output",
"parameters": [
{
"component_id": "begin@lang",
"id": "b2f5e7ec-7f77-485f-af15-461d0f1ca913",
"key": "target_lang"
},
{
"component_id": "begin@file",
"id": "fbc44092-9f9e-4e85-b5b1-dbd808239d3d",
"key": "source_text"
},
{
"component_id": "Generate:RichWordsDeny",
"id": "c253af54-61d4-40f3-9990-604e2212506f",
"key": "translation_1"
}
],
"presence_penalty": 0.4,
"prompt": "Your task is to carefully read a source text and a translation to {target_lang}, and then give constructive criticisms and helpful suggestions to improve the translation. \n\nThe source text and initial translation, delimited by XML tags <SOURCE_TEXT></SOURCE_TEXT> and <TRANSLATION></TRANSLATION>, are as follows:\n\n<SOURCE_TEXT>\n{source_text}\n</SOURCE_TEXT>\n\n<TRANSLATION>\n{translation_1}\n</TRANSLATION>\n\nWhen writing suggestions, pay attention to whether there are ways to improve the translation's \n(i) accuracy (by correcting errors of addition, mistranslation, omission, or untranslated text),\n(ii) fluency (by applying {target_lang} grammar, spelling and punctuation rules, and ensuring there are no unnecessary repetitions),\n(iii) style (by ensuring the translations reflect the style of the source text and take into account any cultural context),\n(iv) terminology (by ensuring terminology use is consistent and reflects the source text domain; and by only ensuring you use equivalent idioms {target_lang}).\n\nWrite a list of specific, helpful and constructive suggestions for improving the translation.\nEach suggestion should address one specific part of the translation.\nOutput only the suggestions and nothing else.",
"query": [],
"temperature": 0.1,
"top_p": 0.3
}
},
"upstream": [
"Generate:RichWordsDeny"
]
},
"begin": {
"downstream": [
"Generate:RichWordsDeny"
],
"obj": {
"component_name": "Begin",
"params": {
"inputs": [],
"message_history_window_size": 22,
"output": {},
"output_var_name": "output",
"prologue": "",
"query": [
{
"key": "lang",
"name": "Target Language",
"optional": false,
"type": "line",
"value": "English"
},
{
"key": "file",
"name": "Files",
"optional": false,
"type": "file",
"value": "https://www.sohu.com/a/828560323_162522?edtsign=70AF5B785A09DF20C126EABC2EC4FB4ABA309622&edtcode=2PBU%2BTiMwCHq%2FwmFSXvzFA%3D%3D&scm=10001.663_14-200000.0.10006.&_f=index_cpc_1_0&spm=smpc.channel_258.block4_314_Y6ubu8_1_fd.11.1732094805514oPmAsKj_1090\n\u666e\u4eac\u6279\u51c6\u65b0\u7248\u4fc4\u6838\u5a01\u6151\u56fd\u5bb6\u57fa\u672c\u653f\u7b56\uff0c\u5916\u4ea4\u90e8\u56de\u5e94_\u5e03\u826f\u65af_\u7f8e\u5236_\u4e2d\u65b9\n\u3010\u73af\u7403\u65f6\u62a5-\u73af\u7403\u7f51\u62a5\u9053 \u8bb0\u8005 \u767d\u4e91\u6021\u3011\u572811\u670820\u65e5\u5916\u4ea4\u90e8\u4f8b\u884c\u8bb0\u8005\u4f1a\u4e0a\uff0c\u6709\u8bb0\u8005\u63d0\u95ee\u79f0\uff0c\u4fc4\u7f57\u65af\u603b\u7edf\u666e\u4eac19\u65e5\u7b7e\u7f72\u603b\u7edf\u4ee4\uff0c\u6279\u51c6\u65b0\u7248\u4fc4\u7f57\u65af\u6838\u5a01\u6151\u56fd\u5bb6\u57fa\u672c\u653f\u7b56\u3002\u6587\u4ef6\u79f0\uff0c\u4fc4\u7f57\u65af\u89c6\u6838\u6b66\u5668\u4e3a\u4e00\u79cd\u5a01\u6151\u624b\u6bb5\uff0c\u4f7f\u7528\u6838\u6b66\u5668\u662f\u6781\u7aef\u60c5\u51b5\u4e0b\u88ab\u8feb\u91c7\u53d6\u7684\u63aa\u65bd\u3002\u540c\u65e5\uff0c\u4fc4\u5e03\u826f\u65af\u514b\u5dde\u906d\u5230\u4e4c\u519b6\u679a\u7f8e\u5236\u5bfc\u5f39\u88ad\u51fb\u3002\u4fc4\u56fd\u9632\u90e8\u7684\u901a\u62a5\u79f0\uff0c\u7ecf\u786e\u8ba4\uff0c\u4e4c\u65b9\u4f7f\u7528\u7684\u662f\u7f8e\u5236\u9646\u519b\u6218\u672f\u5bfc\u5f39\u7cfb\u7edf\uff0c6\u679a\u5bfc\u5f39\u5168\u90e8\u88ab\u4fc4\u519b\u9632\u7a7a\u7cfb\u7edf\u62e6\u622a\uff0c\u5bfc\u5f39\u6b8b\u7247\u843d\u5165\u5e03\u826f\u65af\u514b\u5dde\u4e00\u5904\u519b\u4e8b\u533a\u57df\u5185\u3002\u4e2d\u65b9\u5bf9\u8fd9\u4e24\u4ef6\u4e8b\u60c5\u6709\u4f55\u8bc4\u8bba\uff1f\n\n\u5bf9\u6b64\uff0c\u4e2d\u56fd\u5916\u4ea4\u90e8\u53d1\u8a00\u4eba\u6797\u5251\u8868\u793a\uff0c\u6211\u4eec\u6ce8\u610f\u5230\u4e86\u6709\u5173\u62a5\u9053\u3002\u5f53\u524d\u5f62\u52bf\u4e0b\uff0c\u5404\u65b9\u5e94\u5f53\u4fdd\u6301\u51b7\u9759\u514b\u5236\uff0c\u901a\u8fc7\u5bf9\u8bdd\u534f\u5546\u5171\u540c\u63a8\u52a8\u5c40\u52bf\u7f13\u548c\uff0c\u51cf\u5c11\u6218\u7565\u98ce\u9669\u3002\n\n\u6797\u5251\u5f3a\u8c03\uff0c\u5728\u4e4c\u514b\u5170\u95ee\u9898\u4e0a\uff0c\u4e2d\u65b9\u7684\u7acb\u573a\u662f\u4e00\u8d2f\u7684\u3001\u660e\u786e\u7684\u3002\u4e2d\u65b9\u5e0c\u671b\u5404\u65b9\u63a8\u52a8\u7f13\u548c\u5c40\u52bf\u3001\u81f4\u529b\u4e8e\u653f\u6cbb\u89e3\u51b3\u4e4c\u514b\u5170\u5371\u673a\u7684\u7acb\u573a\u6ca1\u6709\u6539\u53d8\uff0c\u5e76\u5c06\u7ee7\u7eed\u4e3a\u6b64\u53d1\u6325\u5efa\u8bbe\u6027\u4f5c\u7528\u3002 \u8fd4\u56de\u641c\u72d0\uff0c\u67e5\u770b\u66f4\u591a\n\n\u8d23\u4efb\u7f16\u8f91\uff1a \u6bb7\u745e\u6c11 UN949\n----\n"
}
]
}
},
"upstream": []
}
},
"embed_id": "",
"graph": {
"edges": [
{
"id": "reactflow__edge-begin-Generate:RichWordsDenyc",
"markerEnd": "logo",
"source": "begin",
"sourceHandle": null,
"style": {
"stroke": "rgb(202 197 245)",
"strokeWidth": 2
},
"target": "Generate:RichWordsDeny",
"targetHandle": "c",
"type": "buttonEdge"
},
{
"id": "reactflow__edge-Generate:RichWordsDenyb-Generate:SlimyFrogsArguec",
"markerEnd": "logo",
"source": "Generate:RichWordsDeny",
"sourceHandle": "b",
"style": {
"stroke": "rgb(202 197 245)",
"strokeWidth": 2
},
"target": "Generate:SlimyFrogsArgue",
"targetHandle": "c",
"type": "buttonEdge"
},
{
"id": "reactflow__edge-Generate:SlimyFrogsArgueb-Generate:ChubbyCougarsRushc",
"markerEnd": "logo",
"source": "Generate:SlimyFrogsArgue",
"sourceHandle": "b",
"style": {
"stroke": "rgb(202 197 245)",
"strokeWidth": 2
},
"target": "Generate:ChubbyCougarsRush",
"targetHandle": "c",
"type": "buttonEdge"
},
{
"id": "reactflow__edge-Generate:ChubbyCougarsRushb-Answer:TinyGamesGuessc",
"markerEnd": "logo",
"source": "Generate:ChubbyCougarsRush",
"sourceHandle": "b",
"style": {
"stroke": "rgb(202 197 245)",
"strokeWidth": 2
},
"target": "Answer:TinyGamesGuess",
"targetHandle": "c",
"type": "buttonEdge"
}
],
"nodes": [
{
"data": {
"form": {
"prologue": "Hi there! Please enter the text you want to translate in format like: 'text you want to translate' => target language. For an example: 您好! => English"
"prologue": "",
"query": [
{
"key": "lang",
"name": "Target Language",
"optional": false,
"type": "line",
"value": "English"
},
{
"key": "file",
"name": "Files",
"optional": false,
"type": "file",
"value": "https://www.sohu.com/a/828560323_162522?edtsign=70AF5B785A09DF20C126EABC2EC4FB4ABA309622&edtcode=2PBU%2BTiMwCHq%2FwmFSXvzFA%3D%3D&scm=10001.663_14-200000.0.10006.&_f=index_cpc_1_0&spm=smpc.channel_258.block4_314_Y6ubu8_1_fd.11.1732094805514oPmAsKj_1090\n\u666e\u4eac\u6279\u51c6\u65b0\u7248\u4fc4\u6838\u5a01\u6151\u56fd\u5bb6\u57fa\u672c\u653f\u7b56\uff0c\u5916\u4ea4\u90e8\u56de\u5e94_\u5e03\u826f\u65af_\u7f8e\u5236_\u4e2d\u65b9\n\u3010\u73af\u7403\u65f6\u62a5-\u73af\u7403\u7f51\u62a5\u9053 \u8bb0\u8005 \u767d\u4e91\u6021\u3011\u572811\u670820\u65e5\u5916\u4ea4\u90e8\u4f8b\u884c\u8bb0\u8005\u4f1a\u4e0a\uff0c\u6709\u8bb0\u8005\u63d0\u95ee\u79f0\uff0c\u4fc4\u7f57\u65af\u603b\u7edf\u666e\u4eac19\u65e5\u7b7e\u7f72\u603b\u7edf\u4ee4\uff0c\u6279\u51c6\u65b0\u7248\u4fc4\u7f57\u65af\u6838\u5a01\u6151\u56fd\u5bb6\u57fa\u672c\u653f\u7b56\u3002\u6587\u4ef6\u79f0\uff0c\u4fc4\u7f57\u65af\u89c6\u6838\u6b66\u5668\u4e3a\u4e00\u79cd\u5a01\u6151\u624b\u6bb5\uff0c\u4f7f\u7528\u6838\u6b66\u5668\u662f\u6781\u7aef\u60c5\u51b5\u4e0b\u88ab\u8feb\u91c7\u53d6\u7684\u63aa\u65bd\u3002\u540c\u65e5\uff0c\u4fc4\u5e03\u826f\u65af\u514b\u5dde\u906d\u5230\u4e4c\u519b6\u679a\u7f8e\u5236\u5bfc\u5f39\u88ad\u51fb\u3002\u4fc4\u56fd\u9632\u90e8\u7684\u901a\u62a5\u79f0\uff0c\u7ecf\u786e\u8ba4\uff0c\u4e4c\u65b9\u4f7f\u7528\u7684\u662f\u7f8e\u5236\u9646\u519b\u6218\u672f\u5bfc\u5f39\u7cfb\u7edf\uff0c6\u679a\u5bfc\u5f39\u5168\u90e8\u88ab\u4fc4\u519b\u9632\u7a7a\u7cfb\u7edf\u62e6\u622a\uff0c\u5bfc\u5f39\u6b8b\u7247\u843d\u5165\u5e03\u826f\u65af\u514b\u5dde\u4e00\u5904\u519b\u4e8b\u533a\u57df\u5185\u3002\u4e2d\u65b9\u5bf9\u8fd9\u4e24\u4ef6\u4e8b\u60c5\u6709\u4f55\u8bc4\u8bba\uff1f\n\n\u5bf9\u6b64\uff0c\u4e2d\u56fd\u5916\u4ea4\u90e8\u53d1\u8a00\u4eba\u6797\u5251\u8868\u793a\uff0c\u6211\u4eec\u6ce8\u610f\u5230\u4e86\u6709\u5173\u62a5\u9053\u3002\u5f53\u524d\u5f62\u52bf\u4e0b\uff0c\u5404\u65b9\u5e94\u5f53\u4fdd\u6301\u51b7\u9759\u514b\u5236\uff0c\u901a\u8fc7\u5bf9\u8bdd\u534f\u5546\u5171\u540c\u63a8\u52a8\u5c40\u52bf\u7f13\u548c\uff0c\u51cf\u5c11\u6218\u7565\u98ce\u9669\u3002\n\n\u6797\u5251\u5f3a\u8c03\uff0c\u5728\u4e4c\u514b\u5170\u95ee\u9898\u4e0a\uff0c\u4e2d\u65b9\u7684\u7acb\u573a\u662f\u4e00\u8d2f\u7684\u3001\u660e\u786e\u7684\u3002\u4e2d\u65b9\u5e0c\u671b\u5404\u65b9\u63a8\u52a8\u7f13\u548c\u5c40\u52bf\u3001\u81f4\u529b\u4e8e\u653f\u6cbb\u89e3\u51b3\u4e4c\u514b\u5170\u5371\u673a\u7684\u7acb\u573a\u6ca1\u6709\u6539\u53d8\uff0c\u5e76\u5c06\u7ee7\u7eed\u4e3a\u6b64\u53d1\u6325\u5efa\u8bbe\u6027\u4f5c\u7528\u3002 \u8fd4\u56de\u641c\u72d0\uff0c\u67e5\u770b\u66f4\u591a\n\n\u8d23\u4efb\u7f16\u8f91\uff1a \u6bb7\u745e\u6c11 UN949\n----\n"
}
]
},
"label": "Begin",
"name": "Instruction"
"name": "begin"
},
"dragging": false,
"height": 44,
"height": 128,
"id": "begin",
"position": {
"x": -227.62119327532662,
"y": 204.18864081386155
"x": -383.5,
"y": 143.5
},
"positionAbsolute": {
"x": -227.62119327532662,
"y": 204.18864081386155
"x": -383.5,
"y": 143.5
},
"selected": false,
"sourcePosition": "left",
"targetPosition": "right",
"type": "beginNode",
"width": 100
},
{
"data": {
"form": {},
"label": "Answer",
"name": "Interface"
},
"dragging": false,
"height": 44,
"id": "Answer:ShortPapersShake",
"position": {
"x": -2.51245296887717,
"y": 206.25402277426554
},
"positionAbsolute": {
"x": -2.51245296887717,
"y": 206.25402277426554
},
"selected": false,
"sourcePosition": "left",
"targetPosition": "right",
"type": "logicNode",
"width": 200
},
{
"data": {
"form": {
"cite": true,
"cite": false,
"frequencyPenaltyEnabled": true,
"frequency_penalty": 0.7,
"llm_id": "deepseek-chat@DeepSeek",
"maxTokensEnabled": true,
"maxTokensEnabled": false,
"max_tokens": 256,
"message_history_window_size": 12,
"parameter": "Precise",
"parameters": [],
"parameters": [
{
"component_id": "begin@lang",
"id": "a36e78fb-b431-4ae6-afa8-77839587fcf8",
"key": "lang"
},
{
"component_id": "begin@file",
"id": "f8a704b7-693b-4480-aa9a-da4a83250059",
"key": "file"
}
],
"presencePenaltyEnabled": true,
"presence_penalty": 0.4,
"prompt": "You are an professional interpreter.\n- Role: an professional interpreter.\n- Input format: content need to be translated => target language. \n- Answer format: => translated content in target language. \n- Examples:\n - user: 您好! => English. assistant: => How are you doing!\n - user: You look good today. => Japanese. assistant: => 今日は調子がいいですね 。\n",
"prompt": "Role: You are a professional translator proficient in {lang}, with an exceptional ability to convert specialized academic papers into accessible popular science articles. Please assist me in translating the following paragraph into {lang}, ensuring that its style resembles that of popular science articles in {lang}.\n\nRequirements & Restrictions:\n - Use Markdown format to output.\n - DO NOT overlook any details.\n\n\n<ORIGINAL_TEXT>\n{file}\n\n<TRANSLATED_TEXT>",
"temperature": 0.1,
"temperatureEnabled": true,
"topPEnabled": true,
"top_p": 0.3
},
"label": "Generate",
"name": "Translate"
"name": "Translate directly"
},
"dragging": false,
"height": 86,
"id": "Generate:HeavyForksTell",
"height": 190,
"id": "Generate:RichWordsDeny",
"position": {
"x": -1.8557846635797546,
"y": 70.16420357406685
"x": -98,
"y": 113.359375
},
"positionAbsolute": {
"x": -1.8557846635797546,
"y": 70.16420357406685
"x": -98,
"y": 113.359375
},
"selected": false,
"sourcePosition": "right",
@ -149,105 +390,204 @@
{
"data": {
"form": {
"text": "The large model translates the user's desired content into the target language, returns the translated language."
"cite": false,
"frequencyPenaltyEnabled": true,
"frequency_penalty": 0.7,
"llm_id": "deepseek-chat@DeepSeek",
"maxTokensEnabled": false,
"max_tokens": 512,
"message_history_window_size": 12,
"parameter": "Precise",
"parameters": [
{
"component_id": "begin@lang",
"id": "b2f5e7ec-7f77-485f-af15-461d0f1ca913",
"key": "target_lang"
},
"label": "Note",
"name": "N: Translate"
{
"component_id": "begin@file",
"id": "fbc44092-9f9e-4e85-b5b1-dbd808239d3d",
"key": "source_text"
},
{
"component_id": "Generate:RichWordsDeny",
"id": "c253af54-61d4-40f3-9990-604e2212506f",
"key": "translation_1"
}
],
"presencePenaltyEnabled": true,
"presence_penalty": 0.4,
"prompt": "Your task is to carefully read a source text and a translation to {target_lang}, and then give constructive criticisms and helpful suggestions to improve the translation. \n\nThe source text and initial translation, delimited by XML tags <SOURCE_TEXT></SOURCE_TEXT> and <TRANSLATION></TRANSLATION>, are as follows:\n\n<SOURCE_TEXT>\n{source_text}\n</SOURCE_TEXT>\n\n<TRANSLATION>\n{translation_1}\n</TRANSLATION>\n\nWhen writing suggestions, pay attention to whether there are ways to improve the translation's \n(i) accuracy (by correcting errors of addition, mistranslation, omission, or untranslated text),\n(ii) fluency (by applying {target_lang} grammar, spelling and punctuation rules, and ensuring there are no unnecessary repetitions),\n(iii) style (by ensuring the translations reflect the style of the source text and take into account any cultural context),\n(iv) terminology (by ensuring terminology use is consistent and reflects the source text domain; and by only ensuring you use equivalent idioms {target_lang}).\n\nWrite a list of specific, helpful and constructive suggestions for improving the translation.\nEach suggestion should address one specific part of the translation.\nOutput only the suggestions and nothing else.",
"temperature": 0.1,
"temperatureEnabled": true,
"topPEnabled": true,
"top_p": 0.3
},
"label": "Generate",
"name": "Reflect"
},
"dragging": false,
"height": 180,
"id": "Note:VioletNumbersStrive",
"height": 232,
"id": "Generate:SlimyFrogsArgue",
"position": {
"x": 0.8506882512325546,
"y": -119.10519445109118
"x": 178.5,
"y": 91.859375
},
"positionAbsolute": {
"x": 0.8506882512325546,
"y": -119.10519445109118
"x": 178.5,
"y": 91.859375
},
"resizing": false,
"selected": false,
"sourcePosition": "right",
"style": {
"height": 180,
"width": 209
},
"targetPosition": "left",
"type": "noteNode",
"width": 209,
"dragHandle": ".note-drag-handle"
"type": "generateNode",
"width": 200
},
{
"data": {
"form": {
"text": "Receives the content the user wants to translate and the target language, displays the translation result from the large model."
"cite": false,
"frequencyPenaltyEnabled": true,
"frequency_penalty": 0.7,
"llm_id": "deepseek-chat@DeepSeek",
"maxTokensEnabled": false,
"max_tokens": 512,
"message_history_window_size": 12,
"parameter": "Precise",
"parameters": [
{
"component_id": "begin@lang",
"id": "73f48a67-b78f-4bcd-8326-a83c31073ab9",
"key": "target_lang"
},
"label": "Note",
"name": "N: Interface"
{
"component_id": "begin@file",
"id": "c9142975-25b3-4199-8fce-aa0bc29a31f2",
"key": "source_text"
},
{
"component_id": "Generate:RichWordsDeny",
"id": "6c824b2a-fe3b-4336-95b5-e85f676bef39",
"key": "translation_1"
},
{
"component_id": "Generate:SlimyFrogsArgue",
"id": "f3bd4569-4852-43fa-b80a-e0dd27dd9e1c",
"key": "reflection"
}
],
"presencePenaltyEnabled": true,
"presence_penalty": 0.4,
"prompt": "Your task is to carefully read, then edit, a translation to {target_lang}, taking into\naccount a list of expert suggestions and constructive criticisms.\n\nThe source text, the initial translation, and the expert linguist suggestions are delimited by XML tags <SOURCE_TEXT></SOURCE_TEXT>, <TRANSLATION></TRANSLATION> and <EXPERT_SUGGESTIONS></EXPERT_SUGGESTIONS> \\\nas follows:\n\n<SOURCE_TEXT>\n{source_text}\n</SOURCE_TEXT>\n\n<TRANSLATION>\n{translation_1}\n</TRANSLATION>\n\n<EXPERT_SUGGESTIONS>\n{reflection}\n</EXPERT_SUGGESTIONS>\n\nPlease take into account the expert suggestions when editing the translation. Edit the translation by ensuring:\n\n(i) accuracy (by correcting errors of addition, mistranslation, omission, or untranslated text),\n(ii) fluency (by applying {target_lang} grammar, spelling and punctuation rules and ensuring there are no unnecessary repetitions), \n(iii) style (by ensuring the translations reflect the style of the source text)\n(iv) terminology (inappropriate for context, inconsistent use), or\n(v) other errors.\n\nOutput only the new translation and nothing else.",
"temperature": 0.1,
"temperatureEnabled": true,
"topPEnabled": true,
"top_p": 0.3
},
"label": "Generate",
"name": "Improve"
},
"dragging": false,
"height": 157,
"id": "Note:WarmDoodlesSwim",
"height": 274,
"id": "Generate:ChubbyCougarsRush",
"position": {
"x": 22.5293807600396,
"y": 267.8448268086032
"x": 437,
"y": 70.859375
},
"positionAbsolute": {
"x": 22.5293807600396,
"y": 267.8448268086032
"x": 437,
"y": 70.859375
},
"selected": false,
"sourcePosition": "right",
"targetPosition": "left",
"type": "generateNode",
"width": 200
},
{
"data": {
"form": {},
"label": "Answer",
"name": "Interact_0"
},
"dragging": false,
"height": 44,
"id": "Answer:TinyGamesGuess",
"position": {
"x": 688.5,
"y": 183.859375
},
"positionAbsolute": {
"x": 688.5,
"y": 183.859375
},
"selected": false,
"sourcePosition": "right",
"targetPosition": "left",
"type": "logicNode",
"width": 200
},
{
"data": {
"form": {
"text": "Translation Agent: Agentic translation using reflection workflow\n\nThis is inspired by Andrew NG's project: https://github.com/andrewyng/translation-agent\n\n1. Prompt an LLM to translate a text to target_language;\n2. Have the LLM reflect on the translation to come up with constructive suggestions for improving it;\n3. Use the suggestions to improve the translation."
},
"label": "Note",
"name": "Breif"
},
"dragHandle": ".note-drag-handle",
"dragging": false,
"height": 227,
"id": "Note:MoodyKnivesCheat",
"position": {
"x": 46.02198421645994,
"y": -267.69527832581736
},
"positionAbsolute": {
"x": 46.02198421645994,
"y": -267.69527832581736
},
"resizing": false,
"selected": false,
"sourcePosition": "right",
"style": {
"height": 157,
"width": 252
"height": 227,
"width": 703
},
"targetPosition": "left",
"type": "noteNode",
"width": 252,
"dragHandle": ".note-drag-handle"
}
],
"edges": [
{
"id": "reactflow__edge-begin-Answer:ShortPapersShakec",
"markerEnd": "logo",
"source": "begin",
"sourceHandle": null,
"style": {
"stroke": "rgb(202 197 245)",
"strokeWidth": 2
},
"target": "Answer:ShortPapersShake",
"targetHandle": "c",
"type": "buttonEdge"
"width": 703
},
{
"id": "reactflow__edge-Answer:ShortPapersShakeb-Generate:HeavyForksTellb",
"markerEnd": "logo",
"source": "Answer:ShortPapersShake",
"sourceHandle": "b",
"data": {
"form": {
"text": "Many businesses use specialized terms that are not widely used on the internet and that LLMs thus don\u2019t know about, and there are also many terms that can be translated in multiple ways. For example, \u201dopen source\u201d in Spanish can be \u201cC\u00f3digo abierto\u201d or \u201cFuente abierta\u201d; both are fine, but it\u2019d better to pick one and stick with it for a single document.\n\nYou can add those glossary translation into prompt to any of `Translate directly` or 'Reflect'."
},
"label": "Note",
"name": "Tip: Add glossary "
},
"dragHandle": ".note-drag-handle",
"dragging": false,
"height": 181,
"id": "Note:SourCarrotsAct",
"position": {
"x": 65.0676250238289,
"y": 397.6323270065299
},
"positionAbsolute": {
"x": 65.0676250238289,
"y": 397.6323270065299
},
"resizing": false,
"selected": false,
"sourcePosition": "right",
"style": {
"stroke": "rgb(202 197 245)",
"strokeWidth": 2
"height": 181,
"width": 832
},
"target": "Generate:HeavyForksTell",
"targetHandle": "b",
"type": "buttonEdge"
},
{
"id": "reactflow__edge-Generate:HeavyForksTellc-Answer:ShortPapersShakec",
"markerEnd": "logo",
"source": "Generate:HeavyForksTell",
"sourceHandle": "c",
"style": {
"stroke": "rgb(202 197 245)",
"strokeWidth": 2
},
"target": "Answer:ShortPapersShake",
"targetHandle": "c",
"type": "buttonEdge"
"targetPosition": "left",
"type": "noteNode",
"width": 832
}
]
},

View File

@ -134,6 +134,8 @@ def run():
cvs.dsl = json.loads(str(canvas))
UserCanvasService.update_by_id(req["id"], cvs.to_dict())
except Exception as e:
cvs.dsl = json.loads(str(canvas))
UserCanvasService.update_by_id(req["id"], cvs.to_dict())
traceback.print_exc()
yield "data:" + json.dumps({"code": 500, "message": str(e),
"data": {"answer": "**ERROR**: " + str(e), "reference": []}},

View File

@ -111,12 +111,6 @@ def tenant_list():
@manager.route("/agree/<tenant_id>", methods=["PUT"])
@login_required
def agree(tenant_id):
if current_user.id != tenant_id:
return get_json_result(
data=False,
message='No authorization.',
code=settings.RetCode.AUTHENTICATION_ERROR)
try:
UserTenantService.filter_update([UserTenant.tenant_id == tenant_id, UserTenant.user_id == current_user.id], {"role": UserTenantRole.NORMAL})
return get_json_result(data=True)