Skip to content

Commit a7a153c

Browse files
Remove unused code
Fix thinking icon color not switching back to gray
1 parent 409761d commit a7a153c

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

core/llm/llms/Anthropic.ts

+12-24
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ class Anthropic extends BaseLLM {
3939
})),
4040
tool_choice: options.toolChoice
4141
? {
42-
type: "tool",
43-
name: options.toolChoice.function.name,
44-
}
42+
type: "tool",
43+
name: options.toolChoice.function.name,
44+
}
4545
: undefined,
4646
thinking: options.thinking,
4747
};
@@ -133,28 +133,16 @@ class Anthropic extends BaseLLM {
133133
return chatMessage;
134134
}
135135

136-
// Filter out empty thinking blocks before mapping
137-
const filteredContent = Array.isArray(message.content)
138-
? message.content.filter(
139-
(part) =>
140-
!(
141-
part.type === "thinking" &&
142-
(!part.thinking || part.thinking.trim() === "") &&
143-
(!part.signature || part.signature.trim() === "")
144-
),
145-
)
146-
: message.content;
147-
148136
const convertedContent = (
149-
Array.isArray(filteredContent) ? filteredContent : [filteredContent]
137+
Array.isArray(message.content) ? message.content : [message.content]
150138
).map((part, contentIdx) => {
151139
if (part.type === "text") {
152140
const newpart = {
153141
...part,
154142
// If multiple text parts, only add cache_control to the last one
155143
...(addCaching &&
156-
contentIdx ==
157-
(Array.isArray(filteredContent) ? filteredContent.length : 1) - 1
144+
contentIdx ==
145+
(Array.isArray(message.content) ? message.content.length : 1) - 1
158146
? { cache_control: { type: "ephemeral" } }
159147
: {}),
160148
};
@@ -270,12 +258,12 @@ class Anthropic extends BaseLLM {
270258
messages: msgs,
271259
system: shouldCacheSystemMessage
272260
? [
273-
{
274-
type: "text",
275-
text: this.systemMessage,
276-
cache_control: { type: "ephemeral" },
277-
},
278-
]
261+
{
262+
type: "text",
263+
text: this.systemMessage,
264+
cache_control: { type: "ephemeral" },
265+
},
266+
]
279267
: systemMessage,
280268
};
281269

gui/src/components/mainInput/InputToolbar/ToggleThinkingButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export default function ToggleThinkingButton(props: ThinkingButtonProps) {
9292

9393
// Get OpenAI icon color based on reasoning effort
9494
const getIconColor = () => {
95-
if (provider === "openai" && useThinking) {
95+
if (provider === "openai" && useThinking && !props.disabled) {
9696
const effort = thinkingSettings.openai.reasoningEffort;
9797
if (effort === "low") return "text-red-400";
9898
if (effort === "medium") return "text-yellow-400";

0 commit comments

Comments
 (0)