diff --git a/service/convert.go b/service/convert.go index 95acf835ee46..8df0f1121ddd 100644 --- a/service/convert.go +++ b/service/convert.go @@ -149,6 +149,10 @@ func ClaudeToOpenAIRequest(claudeRequest dto.ClaudeRequest, info *relaycommon.Re for _, mediaMsg := range contents { switch mediaMsg.Type { + case "thinking": + if mediaMsg.Thinking != nil { + openAIMessage.ReasoningContent = mediaMsg.Thinking + } case "text", "input_text": message := dto.MediaContent{ Type: "text", diff --git a/web/classic/src/helpers/utils.jsx b/web/classic/src/helpers/utils.jsx index 7c7e63c73740..e32bf5009feb 100644 --- a/web/classic/src/helpers/utils.jsx +++ b/web/classic/src/helpers/utils.jsx @@ -469,6 +469,7 @@ export const formatMessageForAPI = (message) => { return { role: message.role, content: message.content, + reasoning_content: message.reasoningContent || undefined, }; }; diff --git a/web/classic/src/hooks/playground/useSyncMessageAndCustomBody.js b/web/classic/src/hooks/playground/useSyncMessageAndCustomBody.js index 418d781754df..2d1fd59b9dd8 100644 --- a/web/classic/src/hooks/playground/useSyncMessageAndCustomBody.js +++ b/web/classic/src/hooks/playground/useSyncMessageAndCustomBody.js @@ -40,6 +40,7 @@ export const useSyncMessageAndCustomBody = ( id: msg.id, role: msg.role, content: msg.content, + reasoning_content: msg.reasoningContent || undefined, })), ); }, []); @@ -77,6 +78,7 @@ export const useSyncMessageAndCustomBody = ( customPayload.messages = message.map((msg) => ({ role: msg.role, content: msg.content, + reasoning_content: msg.reasoningContent || undefined, })); const newCustomBody = JSON.stringify(customPayload, null, 2); diff --git a/web/default/src/features/playground/lib/message-utils.ts b/web/default/src/features/playground/lib/message-utils.ts index 6128a378044a..9d5f2aed8794 100644 --- a/web/default/src/features/playground/lib/message-utils.ts +++ b/web/default/src/features/playground/lib/message-utils.ts @@ -134,6 +134,7 @@ export function formatMessageForAPI(message: Message): ChatCompletionMessage { return { role: message.from, content: currentVersion.content, + reasoning_content: message.reasoning?.content, } } diff --git a/web/default/src/features/playground/types.ts b/web/default/src/features/playground/types.ts index 11a42e3c4cb1..d96af6b40e60 100644 --- a/web/default/src/features/playground/types.ts +++ b/web/default/src/features/playground/types.ts @@ -46,6 +46,7 @@ export interface Message { export interface ChatCompletionMessage { role: MessageRole content: string | ContentPart[] + reasoning_content?: string } export interface ContentPart {