Both OllamaEngine and MLXEngine had two bugs in URL construction:
1. `axios.create({url: ...})` was used instead of `baseURL`, but `url`
in axios config sets a default request URL - not a base prefix. This
caused the URL to be ignored when `.post()` was called with a path.
2. `this.client.getUri(this.config)` was used to resolve the POST URL,
but passing the engine config (which contains non-axios properties
like `apiKey`, `model`, etc.) produced malformed URLs. When
`apiKey` is null (the default for Ollama), the URL resolved to
`http://localhost:11434/null`, returning HTTP 405.
Fix: construct the full endpoint URL once in the constructor and pass
it directly to `axios.post()`, matching how FlowiseEngine already works.
Co-Authored-By: Claude <noreply@anthropic.com>
- Add chalk to jest transformIgnorePatterns so ESM chalk import works
- Fix wrong mock path in gemini.test.ts (../src -> ../../src)
Signed-off-by: majiayu000 <1835304752@qq.com>
Remove Record<string, unknown> type annotation to let TypeScript infer
the params object type, preserving type checking on all properties.
Cast to ChatCompletionCreateParamsNonStreaming at the create() call site
to accommodate the SDK's missing max_completion_tokens type. Add unit
test for reasoning model detection regex.
Signed-off-by: majiayu000 <1835304752@qq.com>
Newer OpenAI models (o1, o3, o4, gpt-5 series) reject the max_tokens
parameter and require max_completion_tokens instead. These reasoning
models also do not support temperature and top_p parameters.
Conditionally set the correct token parameter and omit unsupported
sampling parameters based on the model name.
Fixes#529
Signed-off-by: majiayu000 <1835304752@qq.com>
Integrated undici ProxyAgent for native fetch and HttpsProxyAgent for axios/openai/anthropic. Upgraded @google/generative-ai to fix#536. Added OCO_PROXY config.
Co-authored-by: uni <uni@hanwei.ink>
Move isHookCalled() check before runMigrations() and
checkIsLatestVersion() so that during git rebase, each pick commit
exits immediately without expensive I/O and network calls.
Also adds missing await on prepareCommitMessageHook() to properly
handle async errors.
Closes#493
Signed-off-by: majiayu000 <1835304752@qq.com>
- Move hardcoded baseURL before ...config spread in constructor
- This allows user config to override the default DeepSeek API URL
- Fixes issue #539 where OCO_API_URL was ignored by DeepSeek engine
This update introduces a centralized error handling mechanism for various AI engines, improving the consistency and clarity of error messages. The new `normalizeEngineError` function standardizes error responses, allowing for better user feedback and recovery suggestions. Additionally, specific error classes for insufficient credits, rate limits, and service availability have been implemented, along with user-friendly formatting for error messages. This refactor aims to enhance the overall user experience when interacting with the AI services.
Add comprehensive setup command with provider selection, API key
configuration, and model selection. Include error recovery for
model-not-found scenarios with suggested alternatives and automatic
retry functionality. Update Anthropic model list with latest versions
and add provider metadata for better user experience.
Introduces AIMLAPI as a supported AI provider, including model list, config validation, and engine implementation. Updates README and engine selection logic to integrate AIMLAPI for chat completions.
Refactor AimlApiEngine response handling
Removed dependency on removeContentTags and simplified message content extraction. Minor header formatting fix for HTTP-Referer. This streamlines the response handling and reduces unnecessary processing.