From 366a7fd5f57291489ac4c07daa07a5d0761cdb85 Mon Sep 17 00:00:00 2001 From: 0xYYBB | ZYY | Bobo <128128010+zhouyongyou@users.noreply.github.com> Date: Thu, 6 Nov 2025 00:35:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(prompts):=20correct=20confidence=20scale=20?= =?UTF-8?q?from=200-1=20to=200-100=20to=20match=20backend=20schema=20(#564?= =?UTF-8?q?)=20##=20Problem=20The=20prompts=20specified=20confidence=20ran?= =?UTF-8?q?ge=20as=200-1=20(float),=20but=20the=20backend=20code=20expects?= =?UTF-8?q?=200-100=20(integer).=20This=20causes=20JSON=20parsing=20errors?= =?UTF-8?q?=20when=20AI=20outputs=20values=20like=200.85:=20```=20Error:?= =?UTF-8?q?=20json:=20cannot=20unmarshal=20number=200.85=20into=20Go=20str?= =?UTF-8?q?uct=20field=20Decision.confidence=20of=20type=20int=20Result:?= =?UTF-8?q?=20confidence=20defaults=20to=200=20```=20##=20Root=20Cause=20*?= =?UTF-8?q?*Backend=20Definition**=20(decision/engine.go:103):=20```go=20C?= =?UTF-8?q?onfidence=20int=20`json:"confidence,omitempty"`=20//=20?= =?UTF-8?q?=E4=BF=A1=E5=BF=83=E5=BA=A6=20(0-100)=20```=20**Prompts=20(befo?= =?UTF-8?q?re=20fix)**:=20-=20adaptive.txt:=20"confidence=20(=E4=BF=A1?= =?UTF-8?q?=E5=BF=83=E5=BA=A6=200-1)"=20-=20nof1.txt:=20"confidence=20(flo?= =?UTF-8?q?at,=200-1)"=20**buildHardSystemPrompt**=20(decision/engine.go:3?= =?UTF-8?q?36):=20```go=20sb.WriteString("-=20`confidence`:=200-100?= =?UTF-8?q?=EF=BC=88=E5=BC=80=E4=BB=93=E5=BB=BA=E8=AE=AE=E2=89=A575?= =?UTF-8?q?=EF=BC=89\n")=20```=20The=20dynamic=20system=20prompt=20was=20c?= =?UTF-8?q?orrect,=20but=20the=20base=20prompts=20contradicted=20it.=20##?= =?UTF-8?q?=20Solution=20Update=20prompt=20files=20to=20use=20consistent?= =?UTF-8?q?=200-100=20integer=20scale:=20###=20adaptive.txt=20-=20`confide?= =?UTF-8?q?nce=20(=E4=BF=A1=E5=BF=83=E5=BA=A6=200-1)`=20=E2=86=92=20`confi?= =?UTF-8?q?dence=20(=E4=BF=A1=E5=BF=83=E5=BA=A6=200-100)`=20-=20`<0.85`=20?= =?UTF-8?q?=E2=86=92=20`<85`=20-=20`0.85-0.90`=20=E2=86=92=20`85-90`=20-?= =?UTF-8?q?=20etc.=20###=20nof1.txt=20-=20`confidence=20(float,=200-1)`=20?= =?UTF-8?q?=E2=86=92=20`confidence=20(int,=200-100)`=20-=20`0.0-0.3`=20?= =?UTF-8?q?=E2=86=92=20`0-30`=20-=20`0.3-0.6`=20=E2=86=92=20`30-60`=20-=20?= =?UTF-8?q?etc.=20##=20Impact=20-=20=E2=9C=85=20Fixes=20JSON=20parsing=20e?= =?UTF-8?q?rrors=20when=20AI=20outputs=20float=20values=20-=20=E2=9C=85=20?= =?UTF-8?q?Aligns=20prompts=20with=20backend=20schema=20-=20=E2=9C=85=20Co?= =?UTF-8?q?nsistent=20with=20buildHardSystemPrompt()=20output=20format=20-?= =?UTF-8?q?=20=E2=9C=85=20No=20breaking=20changes=20(backend=20already=20e?= =?UTF-8?q?xpects=200-100)=20##=20Testing=20```bash=20#=20Verify=20backend?= =?UTF-8?q?=20expects=200-100=20grep=20"Confidence=20int"=20decision/engin?= =?UTF-8?q?e.go=20#=20Output:=20Confidence=20int=20`json:"confidence,omite?= =?UTF-8?q?mpty"`=20//=20=E4=BF=A1=E5=BF=83=E5=BA=A6=20(0-100)=20#=20Verif?= =?UTF-8?q?y=20buildHardSystemPrompt=20uses=200-100=20grep=20"confidence.*?= =?UTF-8?q?0-100"=20decision/engine.go=20#=20Output:=20sb.WriteString("-?= =?UTF-8?q?=20`confidence`:=200-100=EF=BC=88=E5=BC=80=E4=BB=93=E5=BB=BA?= =?UTF-8?q?=E8=AE=AE=E2=89=A575=EF=BC=89\n")=20#=20Build=20test=20go=20bui?= =?UTF-8?q?ld=20./decision/...=20=20#=20=E2=9C=85=20PASS=20```=20##=20Rela?= =?UTF-8?q?ted=20-=20Addresses=20schema=20mismatch=20mentioned=20in=20Issu?= =?UTF-8?q?e=20#557=20-=20Note:=20confidence=20field=20is=20currently=20no?= =?UTF-8?q?t=20validated=20by=20backend=20(validateDecision=20=20=20does?= =?UTF-8?q?=20not=20check=20confidence=20value),=20but=20correct=20schema?= =?UTF-8?q?=20prevents=20parsing=20errors=20---=20Co-authored-by:=20tinkle?= =?UTF-8?q?-community=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prompts/adaptive.txt | 10 +++++----- prompts/nof1.txt | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/prompts/adaptive.txt b/prompts/adaptive.txt index 7b62968a..4990ad23 100644 --- a/prompts/adaptive.txt +++ b/prompts/adaptive.txt @@ -393,12 +393,12 @@ - 明确的市场信号,证明交易逻辑失效 - 例如: "BTC跌破$100k","RSI跌破30","资金费率转负" -4. **confidence** (信心度 0-1) +4. **confidence** (信心度 0-100) - 使用客观评分公式计算(基础分 60 + 条件加减分) - - <0.85: 禁止开仓 - - 0.85-0.90: 风险预算 1.5% - - 0.90-0.95: 风险预算 2% - - >0.95: 风险预算 2.5%(谨慎使用,警惕过度自信) + - <85: 禁止开仓 + - 85-90: 风险预算 1.5% + - 90-95: 风险预算 2% + - >95: 风险预算 2.5%(谨慎使用,警惕过度自信) 5. **risk_usd** (风险金额) - 计算公式: |入场价 - 止损价| × 仓位数量 × 杠杆 diff --git a/prompts/nof1.txt b/prompts/nof1.txt index ef9f797d..f4985468 100644 --- a/prompts/nof1.txt +++ b/prompts/nof1.txt @@ -94,11 +94,11 @@ For EVERY trade decision, you MUST specify: - Examples: "BTC breaks below $100k", "RSI drops below 30", "Funding rate flips negative" - Must be objective and observable -4. **confidence** (float, 0-1): Your conviction level in this trade - - 0.0-0.3: Low confidence (avoid trading or use minimal size) - - 0.3-0.6: Moderate confidence (standard position sizing) - - 0.6-0.8: High confidence (larger position sizing acceptable) - - 0.8-1.0: Very high confidence (use cautiously, beware overconfidence) +4. **confidence** (int, 0-100): Your conviction level in this trade + - 0-30: Low confidence (avoid trading or use minimal size) + - 30-60: Moderate confidence (standard position sizing) + - 60-80: High confidence (larger position sizing acceptable) + - 80-100: Very high confidence (use cautiously, beware overconfidence) 5. **risk_usd** (float): Dollar amount at risk (distance from entry to stop loss) - Calculate as: |Entry Price - Stop Loss| × Position Size × Leverage