Pretor/pretor/adapter/model_adapter
朝夕 600f7c42ab
Feat/deepseek adapter dropin 14224636701039833263 (#50)
* fix: resolve 422 error adding deepseek provider

- Updated `pretor/api/provider.py` to allow "deepseek" as a valid Literal in `ProviderRegister` Pydantic model.
- Validated tests to ensure the backend can correctly receive deepseek configurations.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* fix: complete deepseek provider registration wiring

- Updated `pretor/core/global_state_machine/provider_manager.py` to correctly map `"deepseek"` to `DeepseekProvider`.
- Updated `pretor/core/global_state_machine/model_provider/__init__.py` to export `DeepseekProvider`.
- Confirmed this fully resolves the Provider Manager failing to instantiate DeepSeek despite passing API validation.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* fix: support pydantic-ai decorator proxying on DeepSeekReasonerAgent

- Implemented `__getattr__` on `DeepSeekReasonerAgent` to safely proxy all unrecognized attributes (such as `@agent.system_prompt` and `@agent.tool`) directly to the underlying PydanticAI `Agent` object.
- Resolves the crash where `SupervisoryNode.create_agent()` threw an `AttributeError` when trying to decorate `system_prompt`.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* refactor: remove gemini provider from frontend and backend

- Removed `gemini` from `ProviderRegister` API validator.
- Removed `GeminiProvider` files, tests, and its mappings from `AgentFactory` and `ProviderManager`.
- Removed `gemini` from frontend TypeScript types and UI selection dropdown.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

* fix: parse output with TypeAdapter to support Union types

- Refactored `_parse_output` in `DeepSeekReasonerAgent` to use Pydantic's `TypeAdapter`.
- Resolves a bug where Union types (like `Union[ForConsciousnessNode, ForUser]`) evaluated `hasattr(..., 'model_validate_json')` as `False`, causing the parser to fall back to `json.loads` and return a raw `dict`.
- The `SupervisoryNode` now correctly receives Pydantic objects instead of dictionaries, resolving the `未知响应类型: <class 'dict'>` crash.
- Cleaned up debug scripts to adhere to repository standards.

Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com>
2026-04-28 13:09:51 +08:00
..
__init__.py wip: 优化 2026-04-11 18:14:07 +08:00
agent_factory.py Feat/deepseek adapter dropin 14224636701039833263 (#49) 2026-04-28 12:46:20 +08:00
deepseek_reasoner.py Feat/deepseek adapter dropin 14224636701039833263 (#50) 2026-04-28 13:09:51 +08:00