mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-18 23:25:10 +08:00
fix: use parent_message_id and fresh PoW headers for empty-output retry and continue
Previously retry/continue requests reused the initial PoW header and lacked parent_message_id, causing them to land as disconnected root messages in the DeepSeek session instead of proper follow-up turns. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -13,12 +13,23 @@ func EmptyOutputRetryMaxAttempts() int {
|
||||
}
|
||||
|
||||
func ClonePayloadWithEmptyOutputRetryPrompt(payload map[string]any) map[string]any {
|
||||
return ClonePayloadForEmptyOutputRetry(payload, 0)
|
||||
}
|
||||
|
||||
// ClonePayloadForEmptyOutputRetry creates a retry payload with the suffix
|
||||
// appended and, if parentMessageID > 0, sets parent_message_id so the
|
||||
// retry is submitted as a proper follow-up turn in the same DeepSeek
|
||||
// session rather than a disconnected root message.
|
||||
func ClonePayloadForEmptyOutputRetry(payload map[string]any, parentMessageID int) map[string]any {
|
||||
clone := make(map[string]any, len(payload))
|
||||
for k, v := range payload {
|
||||
clone[k] = v
|
||||
}
|
||||
original, _ := payload["prompt"].(string)
|
||||
clone["prompt"] = AppendEmptyOutputRetrySuffix(original)
|
||||
if parentMessageID > 0 {
|
||||
clone["parent_message_id"] = parentMessageID
|
||||
}
|
||||
return clone
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user