Signature handling for fallback
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
|
||||
import crypto from 'crypto';
|
||||
import { MIN_SIGNATURE_LENGTH } from '../constants.js';
|
||||
import { cacheSignature } from './signature-cache.js';
|
||||
import { MIN_SIGNATURE_LENGTH, getModelFamily } from '../constants.js';
|
||||
import { cacheSignature, cacheThinkingSignature } from './signature-cache.js';
|
||||
|
||||
/**
|
||||
* Convert Google Generative AI response to Anthropic Messages API format
|
||||
@@ -33,6 +33,12 @@ export function convertGoogleToAnthropic(googleResponse, model) {
|
||||
if (part.thought === true) {
|
||||
const signature = part.thoughtSignature || '';
|
||||
|
||||
// Cache thinking signature with model family for cross-model compatibility
|
||||
if (signature && signature.length >= MIN_SIGNATURE_LENGTH) {
|
||||
const modelFamily = getModelFamily(model);
|
||||
cacheThinkingSignature(signature, modelFamily);
|
||||
}
|
||||
|
||||
// Include thinking blocks in the response for Claude Code
|
||||
anthropicContent.push({
|
||||
type: 'thinking',
|
||||
|
||||
Reference in New Issue
Block a user