Skip to content

Commit 63593a2

Browse files
committed
🚸 适配 Pydantic V2
1 parent 3153e60 commit 63593a2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

nonebot_plugin_deepseek/compat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing import Literal, overload
22

33
from nonebot.compat import PYDANTIC_V2
4+
from nonebot.compat import model_dump as model_dump
45

56
__all__ = ("model_validator",)
67

nonebot_plugin_deepseek/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from nonebot import logger, get_plugin_config
88
from pydantic import Field, BaseModel, ConfigDict
99

10-
from .compat import model_validator
1110
from ._types import NOT_GIVEN, NotGivenOr
11+
from .compat import model_dump, model_validator
1212

1313

1414
class ModelConfig:
@@ -123,7 +123,7 @@ def check_max_token(cls, data: Any) -> Any:
123123
return data
124124

125125
def to_dict(self):
126-
return self.model_dump(exclude_unset=True, exclude_none=True, exclude={"name", "base_url"})
126+
return model_dump(self, exclude_unset=True, exclude_none=True, exclude={"name", "base_url"})
127127

128128

129129
class ScopedConfig(BaseModel):

0 commit comments

Comments
 (0)