File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232 // Fast-path patterns for empty text blocks: {"type":"text","text":""}
3333 patternEmptyText = []byte (`"text":""` )
3434 patternEmptyTextSpaced = []byte (`"text": ""` )
35+ patternEmptyTextSp1 = []byte (`"text" : ""` )
36+ patternEmptyTextSp2 = []byte (`"text" :""` )
3537)
3638
3739// SessionContext 粘性会话上下文,用于区分不同来源的请求。
@@ -247,7 +249,9 @@ func FilterThinkingBlocksForRetry(body []byte) []byte {
247249 // Check for empty text blocks: {"type":"text","text":""}
248250 // These cause upstream 400: "text content blocks must be non-empty"
249251 hasEmptyTextBlock := bytes .Contains (body , patternEmptyText ) ||
250- bytes .Contains (body , patternEmptyTextSpaced )
252+ bytes .Contains (body , patternEmptyTextSpaced ) ||
253+ bytes .Contains (body , patternEmptyTextSp1 ) ||
254+ bytes .Contains (body , patternEmptyTextSp2 )
251255
252256 // Fast path: nothing to process
253257 if ! hasThinkingContent && ! hasEmptyContent && ! hasEmptyTextBlock {
Original file line number Diff line number Diff line change @@ -6071,7 +6071,7 @@ func (s *GatewayService) isThinkingBlockSignatureError(respBody []byte) bool {
60716071 // 例如: "all messages must have non-empty content"
60726072 // "messages: text content blocks must be non-empty"
60736073 if strings .Contains (msg , "non-empty content" ) || strings .Contains (msg , "empty content" ) ||
6074- strings .Contains (msg , "must be non-empty" ) {
6074+ strings .Contains (msg , "content blocks must be non-empty" ) {
60756075 logger .LegacyPrintf ("service.gateway" , "[SignatureCheck] Detected empty content error" )
60766076 return true
60776077 }
You can’t perform that action at this time.
0 commit comments