* fix(gemini): merge consecutive same-role messages to fix ordering errors Gemini API requires strict role alternation between "user" and "model". When multiple tool responses (mapped to "user" role) appear consecutively, or when consecutive assistant messages exist, the alternation breaks causing: - "function call turn comes immediately after a user turn or after a function response turn" - "number of function response parts is equal to the number of function call parts" Fix: merge consecutive messages with the same role by combining their parts arrays, applied as a post-processing step after message conversion in both the core Gemini LLM and the openai-adapters Gemini API. Fixes #11047, fixes #9562 * chore: remove verbose comments * refactor: deduplicate mergeConsecutiveGeminiMessages into openai-adapters Export from openai-adapters gemini-types and import in core, removing the duplicate private method from both Gemini classes. * fix: resolve TS2345 by removing explicit nullable type annotation on contents * fix: keep mergeConsecutiveGeminiMessages in each package's own gemini-types The core test suite mocks @continuedev/openai-adapters entirely, which replaces the imported function with a no-op returning undefined. Define the function in both packages' gemini-types to avoid this coupling. |
||
|---|---|---|
| .. | ||
| config-types | ||
| config-yaml | ||
| continue-sdk | ||
| fetch | ||
| hub | ||
| llm-info | ||
| openai-adapters | ||
| terminal-security | ||
| shared-release.config.js | ||