Skip to content

[template] fix thinking list#9679

Merged
Jintao-Huang merged 4 commits into
modelscope:mainfrom
Jintao-Huang:fix_thinking_
Jul 3, 2026
Merged

[template] fix thinking list#9679
Jintao-Huang merged 4 commits into
modelscope:mainfrom
Jintao-Huang:fix_thinking_

Conversation

@Jintao-Huang

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates swift/template/base.py to handle message content that may be formatted as a list instead of a string in both _add_non_thinking_prefix and _remove_history_thinking. The review feedback correctly points out that accessing the first element of the list without checking if it is empty could lead to an IndexError, and provides suggestions to safely handle empty lists.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread swift/template/base.py
Comment thread swift/template/base.py Outdated
@Jintao-Huang Jintao-Huang changed the title fix_thinking list fix thinking list Jul 3, 2026
@Jintao-Huang

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@Jintao-Huang

Copy link
Copy Markdown
Collaborator Author

/gemini review

@Jintao-Huang Jintao-Huang changed the title fix thinking list [template] fix thinking list Jul 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates swift/template/base.py to handle scenarios where message['content'] is a list instead of a string. Specifically, in both _add_non_thinking_prefix and _remove_history_thinking methods, the code now checks if the content is a list and processes its first element accordingly. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@Jintao-Huang
Jintao-Huang merged commit 75a639b into modelscope:main Jul 3, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants