mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-05 08:55:28 +08:00
- ValidateTurn no longer errors on thinking-only responses, deferring to ShouldRetryEmptyOutput which now also covers thinking-only outputs. - Empty output retry uses multi-turn follow-up with a regeneration prompt suffix and parent_message_id in the same DeepSeek session. - Centralize StripReferenceMarkersEnabled into textclean package to eliminate duplicated hardcoded booleans across 4 protocol handlers. - Log a deprecation warning when the legacy "compat" config key is used. - Document thinking-only retry and reference marker stripping in API.md. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
21 lines
546 B
Go
21 lines
546 B
Go
package textclean
|
|
|
|
import "regexp"
|
|
|
|
var referenceMarkerPattern = regexp.MustCompile(`(?i)\[reference:\s*\d+\]`)
|
|
|
|
func StripReferenceMarkers(text string) string {
|
|
if text == "" {
|
|
return text
|
|
}
|
|
return referenceMarkerPattern.ReplaceAllString(text, "")
|
|
}
|
|
|
|
// StripReferenceMarkersEnabled returns true while reference-marker
|
|
// stripping remains the fixed runtime default. When the behaviour is
|
|
// eventually removed this function can be deleted and callers can drop
|
|
// the conditional.
|
|
func StripReferenceMarkersEnabled() bool {
|
|
return true
|
|
}
|