Skip to content
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,5 @@ CLAUDE.md

# Build cache
.cache/ # Includes conda_unpack_wheels/ for Windows packaging workaround
.copaw
.copaw.secret
38 changes: 18 additions & 20 deletions console/src/pages/Control/Channels/components/ChannelDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -541,26 +541,24 @@ export function ChannelDrawer({
</Form.Item>
)}

{activeKey !== "console" && (
<>
<Form.Item
name="filter_tool_messages"
label={t("channels.filterToolMessages")}
valuePropName="checked"
tooltip={t("channels.filterToolMessagesTooltip")}
>
<Switch />
</Form.Item>
<Form.Item
name="filter_thinking"
label={t("channels.filterThinking")}
valuePropName="checked"
tooltip={t("channels.filterThinkingTooltip")}
>
<Switch />
</Form.Item>
</>
)}
<>
<Form.Item
name="filter_tool_messages"
label={t("channels.filterToolMessages")}
valuePropName="checked"
tooltip={t("channels.filterToolMessagesTooltip")}
>
<Switch />
</Form.Item>
<Form.Item
name="filter_thinking"
label={t("channels.filterThinking")}
valuePropName="checked"
tooltip={t("channels.filterThinkingTooltip")}
>
<Switch />
</Form.Item>
</>

{isBuiltin
? renderBuiltinExtraFields(activeKey)
Expand Down
8 changes: 4 additions & 4 deletions console/src/pages/Control/Channels/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ function ChannelsPage() {
const channelConfig = channels[key] || { enabled: false, bot_prefix: "" };
form.setFieldsValue({
...channelConfig,
filter_tool_messages: !channelConfig.filter_tool_messages,
filter_thinking: !channelConfig.filter_thinking,
filter_tool_messages: !Boolean(channelConfig.filter_tool_messages),
filter_thinking: !Boolean(channelConfig.filter_thinking),
});
};

Expand All @@ -74,8 +74,8 @@ function ChannelsPage() {
const updatedChannel: Record<string, unknown> = {
...savedConfig,
...values,
filter_tool_messages: !values.filter_tool_messages,
filter_thinking: !values.filter_thinking,
filter_tool_messages: !Boolean(values.filter_tool_messages),
filter_thinking: !Boolean(values.filter_thinking),
};

setSaving(true);
Expand Down
38 changes: 38 additions & 0 deletions src/copaw/providers/openai_chat_model_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
from agentscope.model import OpenAIChatModel
from agentscope.model._model_response import ChatResponse
from pydantic import BaseModel
from ..local_models.tag_parser import (
extract_thinking_from_text,
text_contains_think_tag,
)


def _clone_with_overrides(obj: Any, **overrides: Any) -> Any:
Expand Down Expand Up @@ -198,6 +202,40 @@ async def _parse_openai_stream_response(
response=sanitized_response,
structured_model=structured_model,
):
if parsed and isinstance(parsed.content, list):
new_content = []
for block in parsed.content:
text_val = block.get("text") if isinstance(block, dict) else None
if (
isinstance(block, dict)
and block.get("type") == "text"
and isinstance(text_val, str)
and text_contains_think_tag(text_val)
):
parsed_thinking = extract_thinking_from_text(
text_val or "",
)
if parsed_thinking.thinking:
new_content.append(
{
"type": "thinking",
"thinking": parsed_thinking.thinking,
},
)
if parsed_thinking.remaining_text:
new_content.append(
{
"type": "text",
"text": parsed_thinking.remaining_text,
},
)
else:
new_content.append(block)
parsed = ChatResponse(
content=new_content,
usage=parsed.usage,
metadata=getattr(parsed, "metadata", None),
)
if sanitized_response.extra_contents:
for block in parsed.content:
if block.get("type") != "tool_use":
Expand Down
Loading