fix: Multiple bug fixes and improvements

- Fix Invalid Date display in Dashboard notifications
- Fix timezone offset (8 hours) in Trading Records time display
- Fix position closing failures due to commission discrepancies (fetch actual exchange position size for reduce_only orders)
- Fix IBKR connection error 'no current event loop in thread' by ensuring asyncio event loop exists
- Fix duplicate orders on same candle by extending signal deduplication to close signals
- Add responsive design for Profile page (mobile-friendly)
- Remove unused strategy_code module and database table
- Fix LLM service to support multiple providers (OpenRouter, OpenAI, DeepSeek, Grok, Google)
- Add auto-detection of configured LLM provider based on API key availability
- Fix AI code generation to use unified LLMService with proper provider selection
- Fix crypto symbol format handling (ETH/USDT no longer becomes ETH/USDT/USDT)
- Fix Commission display showing '0E-8' in Trading Records
- Fix P&L display for signal-only trades (show '--' for unrealized P&L)
- Fix OAuth login not updating last_login_at for new users
- Add migration script for notification_settings column
- Update env.example with new LLM provider configurations
- Remove ESLint rule that was not defined in config
This commit is contained in:
TIANHE
2026-01-24 03:22:14 +08:00
parent 7de1570b3a
commit f4e5a9f8e0
22 changed files with 1358 additions and 464 deletions
@@ -290,7 +290,30 @@ export default {
},
formatTime (timestamp) {
if (!timestamp) return ''
const date = new Date(timestamp * 1000)
// 支持多种时间格式:ISO字符串、秒级时间戳、毫秒级时间戳
let date
if (typeof timestamp === 'number') {
// 数字类型:判断是秒级还是毫秒级时间戳
date = new Date(timestamp < 1e12 ? timestamp * 1000 : timestamp)
} else if (typeof timestamp === 'string') {
// 字符串类型
if (/^\d+$/.test(timestamp)) {
// 纯数字字符串(时间戳)
const ts = parseInt(timestamp, 10)
date = new Date(ts < 1e12 ? ts * 1000 : ts)
} else {
// ISO 日期字符串或其他格式
date = new Date(timestamp)
}
} else {
return ''
}
// 检查日期是否有效
if (isNaN(date.getTime())) {
return ''
}
const now = new Date()
const diff = now - date
const minutes = Math.floor(diff / 60000)
@@ -311,7 +334,24 @@ export default {
},
formatFullTime (timestamp) {
if (!timestamp) return ''
const date = new Date(timestamp * 1000)
// 支持多种时间格式:ISO字符串、秒级时间戳、毫秒级时间戳
let date
if (typeof timestamp === 'number') {
date = new Date(timestamp < 1e12 ? timestamp * 1000 : timestamp)
} else if (typeof timestamp === 'string') {
if (/^\d+$/.test(timestamp)) {
const ts = parseInt(timestamp, 10)
date = new Date(ts < 1e12 ? ts * 1000 : ts)
} else {
date = new Date(timestamp)
}
} else {
return ''
}
if (isNaN(date.getTime())) {
return ''
}
return date.toLocaleString()
},
formatMessageHtml (message) {