mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-15 16:56:56 +08:00
Merge pull request #464 from SkywalkerJi/dev
fix: Fix code formatting to avoid PR Checks / Backend Code Quality (Go) checks reporting errors.
This commit is contained in:
22
main.go
22
main.go
@@ -64,15 +64,15 @@ func syncConfigToDatabase(database *config.Database) error {
|
|||||||
|
|
||||||
// 同步各配置项到数据库
|
// 同步各配置项到数据库
|
||||||
configs := map[string]string{
|
configs := map[string]string{
|
||||||
"admin_mode": fmt.Sprintf("%t", configFile.AdminMode),
|
"admin_mode": fmt.Sprintf("%t", configFile.AdminMode),
|
||||||
"beta_mode": fmt.Sprintf("%t", configFile.BetaMode),
|
"beta_mode": fmt.Sprintf("%t", configFile.BetaMode),
|
||||||
"api_server_port": strconv.Itoa(configFile.APIServerPort),
|
"api_server_port": strconv.Itoa(configFile.APIServerPort),
|
||||||
"use_default_coins": fmt.Sprintf("%t", configFile.UseDefaultCoins),
|
"use_default_coins": fmt.Sprintf("%t", configFile.UseDefaultCoins),
|
||||||
"coin_pool_api_url": configFile.CoinPoolAPIURL,
|
"coin_pool_api_url": configFile.CoinPoolAPIURL,
|
||||||
"oi_top_api_url": configFile.OITopAPIURL,
|
"oi_top_api_url": configFile.OITopAPIURL,
|
||||||
"max_daily_loss": fmt.Sprintf("%.1f", configFile.MaxDailyLoss),
|
"max_daily_loss": fmt.Sprintf("%.1f", configFile.MaxDailyLoss),
|
||||||
"max_drawdown": fmt.Sprintf("%.1f", configFile.MaxDrawdown),
|
"max_drawdown": fmt.Sprintf("%.1f", configFile.MaxDrawdown),
|
||||||
"stop_trading_minutes": strconv.Itoa(configFile.StopTradingMinutes),
|
"stop_trading_minutes": strconv.Itoa(configFile.StopTradingMinutes),
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同步default_coins(转换为JSON字符串存储)
|
// 同步default_coins(转换为JSON字符串存储)
|
||||||
@@ -112,7 +112,7 @@ func syncConfigToDatabase(database *config.Database) error {
|
|||||||
// loadBetaCodesToDatabase 加载内测码文件到数据库
|
// loadBetaCodesToDatabase 加载内测码文件到数据库
|
||||||
func loadBetaCodesToDatabase(database *config.Database) error {
|
func loadBetaCodesToDatabase(database *config.Database) error {
|
||||||
betaCodeFile := "beta_codes.txt"
|
betaCodeFile := "beta_codes.txt"
|
||||||
|
|
||||||
// 检查内测码文件是否存在
|
// 检查内测码文件是否存在
|
||||||
if _, err := os.Stat(betaCodeFile); os.IsNotExist(err) {
|
if _, err := os.Stat(betaCodeFile); os.IsNotExist(err) {
|
||||||
log.Printf("📄 内测码文件 %s 不存在,跳过加载", betaCodeFile)
|
log.Printf("📄 内测码文件 %s 不存在,跳过加载", betaCodeFile)
|
||||||
@@ -126,7 +126,7 @@ func loadBetaCodesToDatabase(database *config.Database) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("🔄 发现内测码文件 %s (%.1f KB),开始加载...", betaCodeFile, float64(fileInfo.Size())/1024)
|
log.Printf("🔄 发现内测码文件 %s (%.1f KB),开始加载...", betaCodeFile, float64(fileInfo.Size())/1024)
|
||||||
|
|
||||||
// 加载内测码到数据库
|
// 加载内测码到数据库
|
||||||
err = database.LoadBetaCodesFromFile(betaCodeFile)
|
err = database.LoadBetaCodesFromFile(betaCodeFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -257,9 +257,9 @@ func (at *AutoTrader) Stop() {
|
|||||||
func (at *AutoTrader) runCycle() error {
|
func (at *AutoTrader) runCycle() error {
|
||||||
at.callCount++
|
at.callCount++
|
||||||
|
|
||||||
log.Printf("\n" + strings.Repeat("=", 70))
|
log.Print("\n" + strings.Repeat("=", 70) + "\n")
|
||||||
log.Printf("⏰ %s - AI决策周期 #%d", time.Now().Format("2006-01-02 15:04:05"), at.callCount)
|
log.Printf("⏰ %s - AI决策周期 #%d", time.Now().Format("2006-01-02 15:04:05"), at.callCount)
|
||||||
log.Printf(strings.Repeat("=", 70))
|
log.Println(strings.Repeat("=", 70))
|
||||||
|
|
||||||
// 创建决策记录
|
// 创建决策记录
|
||||||
record := &logger.DecisionRecord{
|
record := &logger.DecisionRecord{
|
||||||
@@ -346,19 +346,19 @@ func (at *AutoTrader) runCycle() error {
|
|||||||
// 打印系统提示词和AI思维链(即使有错误,也要输出以便调试)
|
// 打印系统提示词和AI思维链(即使有错误,也要输出以便调试)
|
||||||
if decision != nil {
|
if decision != nil {
|
||||||
if decision.SystemPrompt != "" {
|
if decision.SystemPrompt != "" {
|
||||||
log.Printf("\n" + strings.Repeat("=", 70))
|
log.Print("\n" + strings.Repeat("=", 70) + "\n")
|
||||||
log.Printf("📋 系统提示词 [模板: %s] (错误情况)", at.systemPromptTemplate)
|
log.Printf("📋 系统提示词 [模板: %s] (错误情况)", at.systemPromptTemplate)
|
||||||
log.Println(strings.Repeat("=", 70))
|
log.Println(strings.Repeat("=", 70))
|
||||||
log.Println(decision.SystemPrompt)
|
log.Println(decision.SystemPrompt)
|
||||||
log.Printf(strings.Repeat("=", 70) + "\n")
|
log.Println(strings.Repeat("=", 70))
|
||||||
}
|
}
|
||||||
|
|
||||||
if decision.CoTTrace != "" {
|
if decision.CoTTrace != "" {
|
||||||
log.Printf("\n" + strings.Repeat("-", 70))
|
log.Print("\n" + strings.Repeat("-", 70) + "\n")
|
||||||
log.Println("💭 AI思维链分析(错误情况):")
|
log.Println("💭 AI思维链分析(错误情况):")
|
||||||
log.Println(strings.Repeat("-", 70))
|
log.Println(strings.Repeat("-", 70))
|
||||||
log.Println(decision.CoTTrace)
|
log.Println(decision.CoTTrace)
|
||||||
log.Printf(strings.Repeat("-", 70) + "\n")
|
log.Println(strings.Repeat("-", 70))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user