diff --git a/README.md b/README.md index 0a8f0f76f..67ad9f807 100644 --- a/README.md +++ b/README.md @@ -523,7 +523,7 @@ picoclaw onboard weixin Scan the printed QR code with your WeChat mobile app. On success, the token is saved to your config. **2. Configure** -(Optional) Update `allow_from` with your WeChat User ID to restrict who can message the bot: +(Optional) Update `allow_from` with your WeChat User ID to restrict who can message the bot: ```json { "channels": { diff --git a/cmd/picoclaw/internal/onboard/weixin.go b/cmd/picoclaw/internal/onboard/weixin.go index e9e08fa99..721b4f0e9 100644 --- a/cmd/picoclaw/internal/onboard/weixin.go +++ b/cmd/picoclaw/internal/onboard/weixin.go @@ -78,7 +78,7 @@ func runWeixinOnboard(baseURL, proxy string, timeout time.Duration) error { fmt.Println("✓ Config updated. Start the gateway with:") fmt.Println() - fmt.Println(" picoclaw gateway start") + fmt.Println(" picoclaw gateway") fmt.Println() fmt.Println("To restrict which WeChat users can send messages, add their user IDs") fmt.Println("to channels.weixin.allow_from in your config.") diff --git a/docs/channels/weixin/README.md b/docs/channels/weixin/README.md index 3c3fe5c7e..22687fec4 100644 --- a/docs/channels/weixin/README.md +++ b/docs/channels/weixin/README.md @@ -18,7 +18,7 @@ This command will: After onboarding, you can start the gateway: ```bash -picoclaw gateway start +picoclaw gateway ``` --- diff --git a/docs/channels/weixin/README.zh.md b/docs/channels/weixin/README.zh.md index f8111abfa..d5e6f0a49 100644 --- a/docs/channels/weixin/README.zh.md +++ b/docs/channels/weixin/README.zh.md @@ -18,7 +18,7 @@ picoclaw onboard weixin 配置完成后,即可启动网关: ```bash -picoclaw gateway start +picoclaw gateway ``` --- diff --git a/docs/chat-apps.md b/docs/chat-apps.md index a96d7d1e5..07297952a 100644 --- a/docs/chat-apps.md +++ b/docs/chat-apps.md @@ -183,7 +183,7 @@ picoclaw onboard weixin Scan the printed QR code with your WeChat mobile app. On success, the token is saved to your config. **2. Configure** -(Optional) Update `allow_from` with your WeChat User ID to restrict who can message the bot: +(Optional) Update `allow_from` with your WeChat User ID to restrict who can message the bot: ```json { "channels": { diff --git a/pkg/channels/weixin/api.go b/pkg/channels/weixin/api.go index 4d5d25e68..9f4d49ad0 100644 --- a/pkg/channels/weixin/api.go +++ b/pkg/channels/weixin/api.go @@ -32,10 +32,19 @@ func NewApiClient(baseURL, token string, proxy string) (*ApiClient, error) { if proxy != "" { proxyURL, err := url.Parse(proxy) if err != nil { - return nil, fmt.Errorf("invalid proxy URL %q: %v", proxy, err) + return nil, fmt.Errorf("invalid proxy URL %q: %w", proxy, err) } - client.Transport = &http.Transport{ - Proxy: http.ProxyURL(proxyURL), + + // Clone the default transport so we preserve all default settings (TLS, HTTP/2, timeouts, keep-alives) + if defaultTransport, ok := http.DefaultTransport.(*http.Transport); ok { + transport := defaultTransport.Clone() + transport.Proxy = http.ProxyURL(proxyURL) + client.Transport = transport + } else { + // Fallback: preserve previous behavior if DefaultTransport is not the expected type + client.Transport = &http.Transport{ + Proxy: http.ProxyURL(proxyURL), + } } } diff --git a/pkg/channels/weixin/weixin.go b/pkg/channels/weixin/weixin.go index 4db509174..70a999ab5 100644 --- a/pkg/channels/weixin/weixin.go +++ b/pkg/channels/weixin/weixin.go @@ -292,7 +292,7 @@ func (c *WeixinChannel) Send(ctx context.Context, msg bus.OutboundMessage) error logger.ErrorCF("weixin", "Missing context token, cannot send message", map[string]any{ "to_user_id": toUserID, }) - return fmt.Errorf("weixin send: missing context token for chat %s", toUserID) + return fmt.Errorf("weixin send: %w: missing context token for chat %s", channels.ErrSendFailed, toUserID) } clientID := "picoclaw-" + uuid.New().String()