mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-23 10:57:44 +08:00
refactor: update prompt formatting to use system instruction tags and explicit user markers for improved model reasoning
This commit is contained in:
@@ -42,12 +42,15 @@ func MessagesPrepare(messages []map[string]any) string {
|
|||||||
} else {
|
} else {
|
||||||
parts = append(parts, m.Text)
|
parts = append(parts, m.Text)
|
||||||
}
|
}
|
||||||
case "user", "system":
|
case "system":
|
||||||
if i > 0 {
|
// Clear system boundary improves R1 and V3 context understanding significantly
|
||||||
parts = append(parts, "<|User|>"+m.Text)
|
if strings.TrimSpace(m.Text) != "" {
|
||||||
} else {
|
parts = append(parts, "<system_instructions>\n"+strings.TrimSpace(m.Text)+"\n</system_instructions>\n\n")
|
||||||
parts = append(parts, m.Text)
|
|
||||||
}
|
}
|
||||||
|
case "user":
|
||||||
|
// Always prepend <|User|> to user messages. DeepSeek R1 reasoning triggers best
|
||||||
|
// and aligns context perfectly when the user turn is explicitly marked.
|
||||||
|
parts = append(parts, "<|User|>"+m.Text)
|
||||||
default:
|
default:
|
||||||
parts = append(parts, m.Text)
|
parts = append(parts, m.Text)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user