Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions astrbot/core/provider/sources/anthropic_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ async def text_chat(

model = model or self.get_model()

payloads = {**kwargs, "messages": new_messages, "model": model}
payloads = {"messages": new_messages, "model": model}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This change removes the **kwargs from the payloads dictionary. The text_chat method is designed to accept arbitrary keyword arguments (**kwargs) to allow for parameter transparency, enabling users to pass provider-specific parameters directly to the underlying API. Removing **kwargs here prevents this flexibility and can lead to a loss of functionality or extensibility for users who rely on passing additional parameters to the Anthropic API. This reverts the intended behavior of restoring parameter transparency.

payloads = {**kwargs, "messages": new_messages, "model": model}


# Anthropic has a different way of handling system prompts
if system_prompt:
Expand Down Expand Up @@ -571,7 +571,7 @@ async def text_chat_stream(

model = model or self.get_model()

payloads = {**kwargs, "messages": new_messages, "model": model}
payloads = {"messages": new_messages, "model": model}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Similar to the text_chat method, removing **kwargs from the payloads in text_chat_stream eliminates the ability to pass provider-specific parameters to the Anthropic API. This reduces the flexibility and extensibility of the API, which is a functional regression.

payloads = {**kwargs, "messages": new_messages, "model": model}


# Anthropic has a different way of handling system prompts
if system_prompt:
Expand Down
4 changes: 2 additions & 2 deletions astrbot/core/provider/sources/gemini_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ async def text_chat(

model = model or self.get_model()

payloads = {**kwargs, "messages": context_query, "model": model}
payloads = {"messages": context_query, "model": model}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The removal of **kwargs from the payloads dictionary in text_chat for the Gemini provider restricts the ability to pass through additional, provider-specific parameters. This limits the extensibility of the API and can prevent users from utilizing all available features of the Gemini API that are not explicitly defined in the method signature.

payloads = {**kwargs, "messages": context_query, "model": model}


retry = 10
keys = self.api_keys.copy()
Expand Down Expand Up @@ -812,7 +812,7 @@ async def text_chat_stream(

model = model or self.get_model()

payloads = {**kwargs, "messages": context_query, "model": model}
payloads = {"messages": context_query, "model": model}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Removing **kwargs from the payloads in text_chat_stream for the Gemini provider removes parameter transparency. This prevents users from passing custom or provider-specific arguments to the underlying API, which is a functional regression and limits the API's flexibility.

payloads = {**kwargs, "messages": context_query, "model": model}


retry = 10
keys = self.api_keys.copy()
Expand Down
3 changes: 2 additions & 1 deletion astrbot/core/provider/sources/openai_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,8 @@ async def _prepare_chat_payload(
context_query = await self._materialize_context_image_parts(context_query)

model = model or self.get_model()
payloads = {**kwargs, "messages": context_query, "model": model}

payloads = {"messages": context_query, "model": model}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The _prepare_chat_payload function is intended to gather all necessary parameters, including **kwargs, for the OpenAI API call. Removing **kwargs from the payloads dictionary here means that any extra parameters passed to the text_chat or text_chat_stream methods will not be forwarded to the OpenAI API. This significantly reduces the flexibility and extensibility of the provider, as users will be unable to leverage additional API features or custom settings supported by OpenAI but not explicitly exposed in the method signature.

payloads = {**kwargs, "messages": context_query, "model": model}


self._finally_convert_payload(payloads)

Expand Down
Loading