Commit Graph

19 Commits

Author SHA1 Message Date
trungtt6
cd638fff6c Add local AI ollama for security purpose (#226)
Co-authored-by: PhotoPortfolio Developer <developer@photportfolio.local>
2026-02-16 11:28:38 +08:00
Meng Zhuo
8eb9dcd99a Merge pull request #173 from is-Xiaoen/fix/code-review-bugs-116
fix: resolve multiple bugs from code review #116
2026-02-15 09:42:26 +08:00
xiaoen
0a88ff0817 fix: resolve multiple bugs from code review #116
Fixes four issues identified in the community code review:

- Session persistence broken on Windows: session keys like
  "telegram:123456" contain ':', which is illegal in Windows
  filenames. filepath.Base() strips drive-letter prefixes on Windows,
  causing Save() to silently fail. Added sanitizeFilename() to
  replace invalid chars in the filename while keeping the original
  key in the JSON payload.

- HTTP client with no timeout: HTTPProvider used Timeout: 0 (infinite
  wait), which can hang the entire agent if an API endpoint becomes
  unresponsive. Set a 120s safety timeout.

- Slack AllowFrom type mismatch: SlackConfig used plain []string
  while every other channel uses FlexibleStringSlice, so numeric
  user IDs in Slack config would fail to parse.

- Token estimation wrong for CJK: estimateTokens() divided byte
  length by 4, but CJK characters are 3 bytes each, causing ~3x
  overestimation and premature summarization. Switched to
  utf8.RuneCountInString() / 3 for better cross-language accuracy.

Also added unit tests for the session filename sanitization.

Ref #116
2026-02-15 09:36:59 +08:00
Lixeer
16e5a02953 fix(http_provider): Remove extra parameter from CreateProvider function. 2026-02-15 08:06:29 +08:00
Lixeer
5a6ad37dab code fmt 2026-02-15 07:34:12 +08:00
Lixeer
f6d6221c09 make fmt 2026-02-15 07:00:40 +08:00
Lixeer
7a9659971d make fmt 2026-02-15 06:55:20 +08:00
Lixeer
0aab8d8afc feat:add github_copilot to providers factory 2026-02-15 06:10:00 +08:00
Lixeer
18d3634f1b feat: Improve parameter fault tolerance for DeepSeek 2026-02-14 16:47:46 +08:00
Lixeer
afc3a2cda3 feat: add provider deepseek 2026-02-14 16:35:49 +08:00
Avisek
45351a6a79 refactor: Trim trailing slashes from the API base URL and enhance API error messages with status codes. 2026-02-14 02:09:55 +08:00
coohu
896eae4c56 feat: add ShengSuanYun(胜算云) as a models provider. 2026-02-13 15:55:59 +08:00
Leandro Barbosa
f6362ce7b1 feat: add cli-based LLM provider
Add ClaudeCliProvider that executes the local CLI as a subprocess,
enabling PicoClaw to leverage advanced capabilities (MCP tools,
workspace awareness, session management) through any messaging channel.

- Implement LLMProvider interface via subprocess execution
- Support --system-prompt, --model, --output-format json flags
- Parse real v2.x JSON response format including usage tokens
- Handle error responses, stderr, context cancellation
- Register "claude-cli", "claude-code", "claudecode" aliases in CreateProvider
- 56 unit tests with mock scripts + 3 integration tests against real binary
- 100% coverage on all functions except stripToolCallsJSON (85.7%)
2026-02-12 11:51:51 -03:00
mxrain
a9a7a89c07 feat: add Moonshot/Kimi and NVIDIA provider support with proxy 2026-02-12 22:39:38 +08:00
Wutachi
f4a8ff7571 Add provider field support for explicit provider selection
- Add Provider field to AgentDefaults struct
- Modify CreateProvider to use explicit provider field first, fallback to model name detection
- Allows using models without provider prefix (e.g., llama-3.1-8b-instant instead of groq/llama-3.1-8b-instant)
- Supports all providers: groq, openai, anthropic, openrouter, zhipu, gemini, vllm
- Backward compatible with existing configs

Fixes issue where models without provider prefix could not use configured API keys.
2026-02-12 01:01:23 -03:00
Cory LaNou
fbad753b2a feat(providers): add SDK-based providers for subscription OAuth login
Add ClaudeProvider (anthropic-sdk-go) and CodexProvider (openai-go) that
use the correct subscription endpoints and API formats:

- CodexProvider: chatgpt.com/backend-api/codex/responses (Responses API)
  with OAuth Bearer auth and Chatgpt-Account-Id header
- ClaudeProvider: api.anthropic.com/v1/messages (Messages API) with
  Authorization: Bearer token auth

Update CreateProvider() routing to use new SDK-based providers when
auth_method is "oauth" or "token", removing the stopgap that sent
subscription tokens to pay-per-token endpoints.

Closes #18

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 13:27:59 -06:00
Cory LaNou
5efe8a2020 feat(auth): add OAuth and token-based login for OpenAI and Anthropic
Add `picoclaw auth` CLI command supporting:
- OpenAI OAuth2 (PKCE + browser callback or device code flow)
- Anthropic paste-token flow
- Token storage at ~/.picoclaw/auth.json with 0600 permissions
- Auto-refresh for expired OAuth tokens in provider

Closes #18

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 11:41:13 -06:00
Only_Xianzo
6ccd9d0a99 Fix: prioritize explicit provider prefixes and update max_tokens schema 2026-02-11 22:49:47 +08:00
lxowalle
e17693b17c * First commit 2026-02-09 19:20:19 +08:00