mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
c4cbb5fb35
Phase 1: centralize protocol message/tool/response types in protocoltypes and keep compatibility aliases in providers and protocol packages. Phase 1: preserve HTTPProvider constructor compatibility and route Anthropic api_base through factory auth/provider constructors with base URL normalization. Phase 2: expand provider routing/auth tests (deepseek/nvidia/shengsuanyun, codex/claude oauth/codex-cli) and add openai_compat + anthropic coverage for proxy transport, model normalization, numeric option coercion, token-source refresh, and base URL behavior. Phase 3: apply gofmt and validate with Dockerized tests (go test ./pkg/providers/... ./pkg/migrate and go test ./...).
31 lines
799 B
Go
31 lines
799 B
Go
// PicoClaw - Ultra-lightweight personal AI agent
|
|
// Inspired by and based on nanobot: https://github.com/HKUDS/nanobot
|
|
// License: MIT
|
|
//
|
|
// Copyright (c) 2026 PicoClaw contributors
|
|
|
|
package providers
|
|
|
|
import (
|
|
"context"
|
|
"github.com/sipeed/picoclaw/pkg/providers/openai_compat"
|
|
)
|
|
|
|
type HTTPProvider struct {
|
|
delegate *openai_compat.Provider
|
|
}
|
|
|
|
func NewHTTPProvider(apiKey, apiBase, proxy string) *HTTPProvider {
|
|
return &HTTPProvider{
|
|
delegate: openai_compat.NewProvider(apiKey, apiBase, proxy),
|
|
}
|
|
}
|
|
|
|
func (p *HTTPProvider) Chat(ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]interface{}) (*LLMResponse, error) {
|
|
return p.delegate.Chat(ctx, messages, tools, model, options)
|
|
}
|
|
|
|
func (p *HTTPProvider) GetDefaultModel() string {
|
|
return ""
|
|
}
|