fix(agent): use provider registry for claw402, echo reasoning_content for thinking models, add Beta badge

- Agent now uses mcp.NewAIClientByProvider() for claw402 provider, ensuring
  x402 payment signing works correctly instead of generic HTTP client
- Added ReasoningContent field to Message/LLMResponse structs and wired
  serialization/parsing so DeepSeek thinking models work in multi-turn
- Added Beta badge to Agent nav tab in HeaderBar

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shinchan-zhai
2026-05-11 20:22:32 +08:00
parent b8cde34e67
commit 9f25bf49bf
5 changed files with 38 additions and 12 deletions

View File

@@ -165,13 +165,26 @@ func (a *Agent) loadAIClientFromStoreUser(storeUserID string) (mcp.AIClient, str
apiKey := strings.TrimSpace(string(model.APIKey))
customAPIURL := strings.TrimSpace(model.CustomAPIURL)
modelName := strings.TrimSpace(model.CustomModelName)
customAPIURL, modelName = resolveModelRuntimeConfig(model.Provider, customAPIURL, modelName, model.ID)
provider := strings.ToLower(strings.TrimSpace(model.Provider))
// Use the provider registry for providers like claw402 that have their own
// client implementation (x402 payment, custom auth, etc.).
if client := mcp.NewAIClientByProvider(provider); client != nil {
if modelName == "" {
modelName = model.ID
}
client.SetAPIKey(apiKey, customAPIURL, modelName)
a.log().Info("agent AI client selected (provider registry)", "store_user_id", candidateUserID, "model_id", model.ID, "provider", provider, "model", modelName)
return client, modelName, true
}
customAPIURL, modelName = resolveModelRuntimeConfig(provider, customAPIURL, modelName, model.ID)
if apiKey == "" || customAPIURL == "" {
a.log().Warn(
"skipping incomplete enabled AI model",
"store_user_id", candidateUserID,
"model_id", model.ID,
"provider", model.Provider,
"provider", provider,
"has_api_key", apiKey != "",
"has_custom_api_url", customAPIURL != "",
)

View File

@@ -4014,6 +4014,9 @@ func (a *Agent) thinkAndActLegacyWithStore(ctx context.Context, storeUserID stri
if resp.Content != "" {
assistantMsg.Content = resp.Content
}
if resp.ReasoningContent != "" {
assistantMsg.ReasoningContent = resp.ReasoningContent
}
messages = append(messages, assistantMsg)
for _, tc := range resp.ToolCalls {