Skip to content

Commit e5ef7fe

Browse files
committed
fix: kimi reasoning and docs
1 parent a8a5a3a commit e5ef7fe

4 files changed

Lines changed: 908 additions & 179 deletions

File tree

core/relay/adaptor/moonshot/adaptor.go

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,21 @@ func (a *Adaptor) ConvertRequest(
9191
},
9292
)
9393
case mode.Anthropic:
94-
return openai.ConvertClaudeRequest(meta, req, func(openAIReq *relaymodel.GeneralOpenAIRequest) error {
95-
return patchReasoningRequest(meta, openAIReq)
96-
})
94+
return openai.ConvertClaudeRequest(
95+
meta,
96+
req,
97+
func(openAIReq *relaymodel.GeneralOpenAIRequest) error {
98+
return patchReasoningRequest(meta, openAIReq)
99+
},
100+
)
97101
case mode.Gemini:
98-
return openai.ConvertGeminiRequest(meta, req, func(openAIReq *relaymodel.GeneralOpenAIRequest) error {
99-
return patchReasoningRequest(meta, openAIReq)
100-
})
102+
return openai.ConvertGeminiRequest(
103+
meta,
104+
req,
105+
func(openAIReq *relaymodel.GeneralOpenAIRequest) error {
106+
return patchReasoningRequest(meta, openAIReq)
107+
},
108+
)
101109
default:
102110
return a.Adaptor.ConvertRequest(meta, store, req)
103111
}
@@ -135,7 +143,8 @@ func applyReasoningToMoonshotNode(
135143
}
136144

137145
thinkingType := relaymodel.ClaudeThinkingTypeEnabled
138-
if reasoning.Disabled || utils.ReasoningToOpenAIEffort(reasoning) == relaymodel.ReasoningEffortNone {
146+
if reasoning.Disabled ||
147+
utils.ReasoningToOpenAIEffort(reasoning) == relaymodel.ReasoningEffortNone {
139148
thinkingType = relaymodel.ClaudeThinkingTypeDisabled
140149
}
141150

@@ -161,7 +170,8 @@ func applyReasoningToMoonshotRequest(
161170
}
162171

163172
thinkingType := relaymodel.ClaudeThinkingTypeEnabled
164-
if reasoning.Disabled || utils.ReasoningToOpenAIEffort(reasoning) == relaymodel.ReasoningEffortNone {
173+
if reasoning.Disabled ||
174+
utils.ReasoningToOpenAIEffort(reasoning) == relaymodel.ReasoningEffortNone {
165175
thinkingType = relaymodel.ClaudeThinkingTypeDisabled
166176
}
167177

core/relay/adaptor/moonshot/adaptor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func TestConvertChatCompletionsRequestDropsReasoningForNonToggleKimiModel(t *tes
175175
}
176176
}
177177

178-
func newJSONRequest(t *testing.T, path string, body string) *http.Request {
178+
func newJSONRequest(t *testing.T, path, body string) *http.Request {
179179
t.Helper()
180180

181181
req, err := http.NewRequestWithContext(

0 commit comments

Comments
 (0)