feat(trading-assistant): refactor strategy creation and enhance script mode functionality
- Removed conditional rendering for the assistant guide bar. - Simplified strategy overview and strategy list item components. - Introduced a new modal for selecting strategy mode. - Enhanced strategy creation modal to support script strategies with a dedicated editor. - Updated form handling for script strategies, including validation and submission logic. - Improved user experience with better messaging and streamlined UI components. - Updated translations for better clarity in Chinese.
This commit is contained in:
@@ -709,7 +709,7 @@ IMPORTANT: Output Python code directly, without explanations, without descriptio
|
||||
reference_id=f"ai_code_gen_{user_id}_{int(time.time())}"
|
||||
)
|
||||
if not ok:
|
||||
yield "data: " + json.dumps({"error": f"积分不足: {msg}"}, ensure_ascii=False) + "\n\n"
|
||||
yield "data: " + json.dumps({"error": f"Insufficient credits: {msg}"}, ensure_ascii=False) + "\n\n"
|
||||
yield "data: [DONE]\n\n"
|
||||
return
|
||||
|
||||
|
||||
@@ -1010,7 +1010,7 @@ def get_openrouter_balance():
|
||||
if not api_key:
|
||||
return jsonify({
|
||||
'code': 0,
|
||||
'msg': 'OpenRouter API Key 未配置',
|
||||
'msg': 'OpenRouter API key is not configured',
|
||||
'data': None
|
||||
})
|
||||
|
||||
@@ -1050,27 +1050,27 @@ def get_openrouter_balance():
|
||||
elif resp.status_code == 401:
|
||||
return jsonify({
|
||||
'code': 0,
|
||||
'msg': 'API Key 无效或已过期',
|
||||
'msg': 'API key is invalid or expired',
|
||||
'data': None
|
||||
})
|
||||
else:
|
||||
return jsonify({
|
||||
'code': 0,
|
||||
'msg': f'查询失败: HTTP {resp.status_code}',
|
||||
'msg': f'Query failed: HTTP {resp.status_code}',
|
||||
'data': None
|
||||
})
|
||||
|
||||
except requests.exceptions.Timeout:
|
||||
return jsonify({
|
||||
'code': 0,
|
||||
'msg': '请求超时,请检查网络连接',
|
||||
'msg': 'Request timed out. Please check the network connection.',
|
||||
'data': None
|
||||
})
|
||||
except Exception as e:
|
||||
logger.error(f"Get OpenRouter balance failed: {e}")
|
||||
return jsonify({
|
||||
'code': 0,
|
||||
'msg': f'查询失败: {str(e)}',
|
||||
'msg': f'Query failed: {str(e)}',
|
||||
'data': None
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user