修复未传系统提示词时的报错
Browse files
src/utils/converters/common.js
CHANGED
|
@@ -14,7 +14,7 @@ import { getThoughtSignatureForModel, getToolSignatureForModel, sanitizeToolName
|
|
| 14 |
export function getSignatureContext(sessionId, actualModelName) {
|
| 15 |
const cachedReasoningSig = getReasoningSignature(sessionId, actualModelName);
|
| 16 |
const cachedToolSig = getToolSignature(sessionId, actualModelName);
|
| 17 |
-
|
| 18 |
return {
|
| 19 |
reasoningSignature: cachedReasoningSig || getThoughtSignatureForModel(actualModelName),
|
| 20 |
toolSignature: cachedToolSig || getToolSignatureForModel(actualModelName)
|
|
@@ -192,10 +192,10 @@ export function mergeSystemInstruction(baseSystem, contextSystem) {
|
|
| 192 |
if (!config.useContextSystemPrompt || !contextSystem) {
|
| 193 |
return baseSystem || '';
|
| 194 |
}
|
| 195 |
-
|
| 196 |
const parts = [];
|
| 197 |
-
if (baseSystem && baseSystem.trim()) parts.push(baseSystem.trim());
|
| 198 |
-
if (contextSystem && contextSystem.trim()) parts.push(contextSystem.trim());
|
| 199 |
return parts.join('\n\n');
|
| 200 |
}
|
| 201 |
|
|
@@ -209,4 +209,4 @@ export {
|
|
| 209 |
normalizeGeminiParameters,
|
| 210 |
normalizeParameters,
|
| 211 |
toGenerationConfig
|
| 212 |
-
} from '../parameterNormalizer.js';
|
|
|
|
| 14 |
export function getSignatureContext(sessionId, actualModelName) {
|
| 15 |
const cachedReasoningSig = getReasoningSignature(sessionId, actualModelName);
|
| 16 |
const cachedToolSig = getToolSignature(sessionId, actualModelName);
|
| 17 |
+
|
| 18 |
return {
|
| 19 |
reasoningSignature: cachedReasoningSig || getThoughtSignatureForModel(actualModelName),
|
| 20 |
toolSignature: cachedToolSig || getToolSignatureForModel(actualModelName)
|
|
|
|
| 192 |
if (!config.useContextSystemPrompt || !contextSystem) {
|
| 193 |
return baseSystem || '';
|
| 194 |
}
|
| 195 |
+
|
| 196 |
const parts = [];
|
| 197 |
+
if (baseSystem && typeof baseSystem === 'string' && baseSystem.trim()) parts.push(baseSystem.trim());
|
| 198 |
+
if (contextSystem && typeof contextSystem === 'string' && contextSystem.trim()) parts.push(contextSystem.trim());
|
| 199 |
return parts.join('\n\n');
|
| 200 |
}
|
| 201 |
|
|
|
|
| 209 |
normalizeGeminiParameters,
|
| 210 |
normalizeParameters,
|
| 211 |
toGenerationConfig
|
| 212 |
+
} from '../parameterNormalizer.js';
|