mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-22 01:55:27 -04:00
[PR #2548] [CLOSED] fix(tongyi): ensure user message exists for kimi models #2561
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/langgenius/dify-official-plugins/pull/2548
Author: @ZenKaiii
Created: 2/5/2026
Status: ❌ Closed
Base:
main← Head:fix/tongyi-kimi-default-user-message📝 Commits (1)
3107ecafix(tongyi): ensure user message exists for kimi models📊 Changes
1 file changed (+13 additions, -2 deletions)
View changed files
📝
models/tongyi/models/llm/llm.py(+13 -2)📄 Description
Summary
Fix an issue where kimi series models fail when no user message is provided in the prompt.
Problem
Kimi models (kimi-k2.5, kimi-k2-thinking, Moonshot-Kimi-K2-Instruct) require at least one message with role=user in the input. When Dify LLM nodes only provide system messages, the API returns error about missing user role.
Solution
Added a check in _convert_prompt_messages_to_tongyi_messages() to ensure at least one user message exists for kimi series models. If no user message is found, a default user message with a single space is automatically added.
Changes
Testing
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.