fix: i18n_getmsgs.dspy 返回扁平字典格式
This commit is contained in:
parent
156767b1e8
commit
9f66377222
@ -1,18 +1,14 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def main():
|
lang = params.get('lang', 'zh')
|
||||||
lang = params.get('lang', 'zh')
|
i18n_dir = os.path.join(os.path.dirname(__file__), lang)
|
||||||
i18n_dir = os.path.join(os.path.dirname(__file__), lang)
|
i18n_file = os.path.join(i18n_dir, 'i18n.json')
|
||||||
i18n_file = os.path.join(i18n_dir, 'i18n.json')
|
|
||||||
|
if os.path.exists(i18n_file):
|
||||||
if os.path.exists(i18n_file):
|
with open(i18n_file, 'r', encoding='utf-8') as f:
|
||||||
with open(i18n_file, 'r', encoding='utf-8') as f:
|
msgs = json.load(f)
|
||||||
msgs = json.load(f)
|
else:
|
||||||
else:
|
msgs = {}
|
||||||
msgs = {}
|
|
||||||
|
return json.dumps(msgs, ensure_ascii=False)
|
||||||
return json.dumps({
|
|
||||||
"success": True,
|
|
||||||
"msgs": msgs
|
|
||||||
}, ensure_ascii=False)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user