qing-client 0.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. qing_client-0.0.0/PKG-INFO +106 -0
  2. qing_client-0.0.0/README.md +87 -0
  3. qing_client-0.0.0/pyproject.toml +42 -0
  4. qing_client-0.0.0/qing_client.egg-info/PKG-INFO +106 -0
  5. qing_client-0.0.0/qing_client.egg-info/SOURCES.txt +64 -0
  6. qing_client-0.0.0/qing_client.egg-info/dependency_links.txt +1 -0
  7. qing_client-0.0.0/qing_client.egg-info/requires.txt +7 -0
  8. qing_client-0.0.0/qing_client.egg-info/top_level.txt +1 -0
  9. qing_client-0.0.0/qingclient/__init__.py +49 -0
  10. qing_client-0.0.0/qingclient/_version.py +34 -0
  11. qing_client-0.0.0/qingclient/ai_service.py +91 -0
  12. qing_client-0.0.0/qingclient/aigc_service.py +41 -0
  13. qing_client-0.0.0/qingclient/audit_service.py +37 -0
  14. qing_client-0.0.0/qingclient/auth_service.py +266 -0
  15. qing_client-0.0.0/qingclient/base_client.py +278 -0
  16. qing_client-0.0.0/qingclient/client.py +125 -0
  17. qing_client-0.0.0/qingclient/delivery_stream_service.py +55 -0
  18. qing_client-0.0.0/qingclient/ez_ability_service.py +54 -0
  19. qing_client-0.0.0/qingclient/file_service.py +108 -0
  20. qing_client-0.0.0/qingclient/fronthost_service.py +48 -0
  21. qing_client-0.0.0/qingclient/hub_service.py +46 -0
  22. qing_client-0.0.0/qingclient/im_service.py +48 -0
  23. qing_client-0.0.0/qingclient/msg_service.py +217 -0
  24. qing_client-0.0.0/qingclient/org_service.py +65 -0
  25. qing_client-0.0.0/qingclient/provider_service.py +48 -0
  26. qing_client-0.0.0/qingclient/task_service.py +93 -0
  27. qing_client-0.0.0/qingclient/token_service.py +99 -0
  28. qing_client-0.0.0/qingclient/types/__init__.py +102 -0
  29. qing_client-0.0.0/qingclient/types/auth.py +82 -0
  30. qing_client-0.0.0/qingclient/types/base.py +70 -0
  31. qing_client-0.0.0/qingclient/types/config.py +44 -0
  32. qing_client-0.0.0/qingclient/types/msg.py +96 -0
  33. qing_client-0.0.0/qingclient/types/token.py +56 -0
  34. qing_client-0.0.0/qingclient/types/user.py +63 -0
  35. qing_client-0.0.0/qingclient/usage_service.py +41 -0
  36. qing_client-0.0.0/qingclient/user_service.py +146 -0
  37. qing_client-0.0.0/setup.cfg +4 -0
  38. qing_client-0.0.0/setup.py +4 -0
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.4
2
+ Name: qing-client
3
+ Version: 0.0.0
4
+ Summary: Qing 平台统一 SDK - Python 客户端(与 npm 版 qing-client 对齐)
5
+ Author-email: xiaoyue9527 <xiaoyue9527@example.com>
6
+ License: MIT
7
+ Keywords: qing,sdk,api-client
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests>=2.28.0
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest>=7.0; extra == "dev"
16
+ Requires-Dist: pytest-asyncio>=0.20.0; extra == "dev"
17
+ Requires-Dist: twine>=4.0.0; extra == "dev"
18
+ Requires-Dist: build>=0.10.0; extra == "dev"
19
+
20
+ # qing-client (Python)
21
+
22
+ Qing 平台统一 SDK 的 Python 版本,与 npm 包 `qing-client` 的 API 设计对齐。
23
+
24
+ ## 安装
25
+
26
+ ```bash
27
+ pip install -e /path/to/client/pip
28
+ # 或发布后
29
+ pip install qing-client
30
+ ```
31
+
32
+ ## 使用
33
+
34
+ ### 网关模式(前端/统一网关)
35
+
36
+ ```python
37
+ from qingclient import Client
38
+ from qingclient.types import ClientConfig
39
+
40
+ config = ClientConfig(
41
+ gateway_url="https://your-gateway.example.com",
42
+ project_id="your-project-id",
43
+ # 可选: org_id, app_id
44
+ )
45
+ client = Client(config)
46
+
47
+ # 登录后设置 token
48
+ res = client.auth.login("user", "password")
49
+ client.set_token(res.access_token)
50
+
51
+ # 调用各服务
52
+ user = client.user.get_current_user()
53
+ messages = client.msg.get_messages()
54
+ ```
55
+
56
+ ### 后端模式(直连各服务)
57
+
58
+ 直连时各服务 URL 需包含该服务在后端的路径前缀,例如 token 服务为 `.../api/token`,这样 path `/wxh5/accesstoken` 才会请求到正确的完整路径。详见根目录 [client/README.md](../README.md) 的「SDK 与现有架构对齐说明」。
59
+
60
+ ```python
61
+ from qingclient import Client
62
+ from qingclient.types import ClientConfig, UserContext
63
+
64
+ config = ClientConfig(
65
+ auth_service_url="http://auth-svc",
66
+ msg_service_url="http://msg-svc",
67
+ user_service_url="http://user-svc",
68
+ token_service_url="http://token-svc/api/token", # 含路径前缀
69
+ # ... 其他服务 URL
70
+ )
71
+ client = Client(config)
72
+
73
+ # 设置用户上下文(模拟请求方)
74
+ client.set_user_context(UserContext(
75
+ user_id="uid",
76
+ role="ADMIN",
77
+ project_id="pid",
78
+ ))
79
+
80
+ # 调用服务
81
+ messages = client.msg.get_messages()
82
+ ```
83
+
84
+ ### 服务列表(与 npm 一致)
85
+
86
+ - `client.auth` - 认证
87
+ - `client.msg` - 消息
88
+ - `client.user` - 用户
89
+ - `client.token` - Token 中控(公众号/小程序 access_token、jsapi_ticket、签名、小程序登录与获取手机号等)
90
+ - `client.file` - 文件
91
+ - `client.ai` - AI 对话
92
+ - `client.aigc` - AIGC
93
+ - `client.provider` - 提供商
94
+ - `client.usage` - 用量
95
+ - `client.audit` - 审计日志
96
+ - `client.fronthost` - 前端托管
97
+ - `client.org` - 组织
98
+ - `client.delivery_stream` - 投递流
99
+ - `client.ez_ability` - Ez 能力
100
+ - `client.im` - IM
101
+ - `client.hub` - 能力枢纽
102
+ - `client.task` - 任务
103
+
104
+ ## 版本
105
+
106
+ 与 npm 包版本号对齐,见 `pyproject.toml` / setuptools-scm 或根目录 client 版本说明。
@@ -0,0 +1,87 @@
1
+ # qing-client (Python)
2
+
3
+ Qing 平台统一 SDK 的 Python 版本,与 npm 包 `qing-client` 的 API 设计对齐。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pip install -e /path/to/client/pip
9
+ # 或发布后
10
+ pip install qing-client
11
+ ```
12
+
13
+ ## 使用
14
+
15
+ ### 网关模式(前端/统一网关)
16
+
17
+ ```python
18
+ from qingclient import Client
19
+ from qingclient.types import ClientConfig
20
+
21
+ config = ClientConfig(
22
+ gateway_url="https://your-gateway.example.com",
23
+ project_id="your-project-id",
24
+ # 可选: org_id, app_id
25
+ )
26
+ client = Client(config)
27
+
28
+ # 登录后设置 token
29
+ res = client.auth.login("user", "password")
30
+ client.set_token(res.access_token)
31
+
32
+ # 调用各服务
33
+ user = client.user.get_current_user()
34
+ messages = client.msg.get_messages()
35
+ ```
36
+
37
+ ### 后端模式(直连各服务)
38
+
39
+ 直连时各服务 URL 需包含该服务在后端的路径前缀,例如 token 服务为 `.../api/token`,这样 path `/wxh5/accesstoken` 才会请求到正确的完整路径。详见根目录 [client/README.md](../README.md) 的「SDK 与现有架构对齐说明」。
40
+
41
+ ```python
42
+ from qingclient import Client
43
+ from qingclient.types import ClientConfig, UserContext
44
+
45
+ config = ClientConfig(
46
+ auth_service_url="http://auth-svc",
47
+ msg_service_url="http://msg-svc",
48
+ user_service_url="http://user-svc",
49
+ token_service_url="http://token-svc/api/token", # 含路径前缀
50
+ # ... 其他服务 URL
51
+ )
52
+ client = Client(config)
53
+
54
+ # 设置用户上下文(模拟请求方)
55
+ client.set_user_context(UserContext(
56
+ user_id="uid",
57
+ role="ADMIN",
58
+ project_id="pid",
59
+ ))
60
+
61
+ # 调用服务
62
+ messages = client.msg.get_messages()
63
+ ```
64
+
65
+ ### 服务列表(与 npm 一致)
66
+
67
+ - `client.auth` - 认证
68
+ - `client.msg` - 消息
69
+ - `client.user` - 用户
70
+ - `client.token` - Token 中控(公众号/小程序 access_token、jsapi_ticket、签名、小程序登录与获取手机号等)
71
+ - `client.file` - 文件
72
+ - `client.ai` - AI 对话
73
+ - `client.aigc` - AIGC
74
+ - `client.provider` - 提供商
75
+ - `client.usage` - 用量
76
+ - `client.audit` - 审计日志
77
+ - `client.fronthost` - 前端托管
78
+ - `client.org` - 组织
79
+ - `client.delivery_stream` - 投递流
80
+ - `client.ez_ability` - Ez 能力
81
+ - `client.im` - IM
82
+ - `client.hub` - 能力枢纽
83
+ - `client.task` - 任务
84
+
85
+ ## 版本
86
+
87
+ 与 npm 包版本号对齐,见 `pyproject.toml` / setuptools-scm 或根目录 client 版本说明。
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel", "setuptools-scm"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [tool.setuptools_scm]
6
+ version_file = "version.txt"
7
+ write_to = "qingclient/_version.py"
8
+ local_scheme = "no-local-version"
9
+ fallback_version = "0.0.0"
10
+
11
+ [tool.setuptools]
12
+ packages = ["qingclient", "qingclient.types"]
13
+ package-dir = {"" = "."}
14
+
15
+ [project]
16
+ name = "qing-client"
17
+ dynamic = ["version"]
18
+ description = "Qing 平台统一 SDK - Python 客户端(与 npm 版 qing-client 对齐)"
19
+ readme = "README.md"
20
+ requires-python = ">=3.8"
21
+ authors = [
22
+ { name = "xiaoyue9527", email = "xiaoyue9527@example.com" },
23
+ ]
24
+ license = { text = "MIT" }
25
+ classifiers = [
26
+ "Programming Language :: Python :: 3",
27
+ "License :: OSI Approved :: MIT License",
28
+ "Operating System :: OS Independent",
29
+ ]
30
+ keywords = ["qing", "sdk", "api-client"]
31
+
32
+ dependencies = [
33
+ "requests>=2.28.0",
34
+ ]
35
+
36
+ [project.optional-dependencies]
37
+ dev = [
38
+ "pytest>=7.0",
39
+ "pytest-asyncio>=0.20.0",
40
+ "twine>=4.0.0",
41
+ "build>=0.10.0",
42
+ ]
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.4
2
+ Name: qing-client
3
+ Version: 0.0.0
4
+ Summary: Qing 平台统一 SDK - Python 客户端(与 npm 版 qing-client 对齐)
5
+ Author-email: xiaoyue9527 <xiaoyue9527@example.com>
6
+ License: MIT
7
+ Keywords: qing,sdk,api-client
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests>=2.28.0
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest>=7.0; extra == "dev"
16
+ Requires-Dist: pytest-asyncio>=0.20.0; extra == "dev"
17
+ Requires-Dist: twine>=4.0.0; extra == "dev"
18
+ Requires-Dist: build>=0.10.0; extra == "dev"
19
+
20
+ # qing-client (Python)
21
+
22
+ Qing 平台统一 SDK 的 Python 版本,与 npm 包 `qing-client` 的 API 设计对齐。
23
+
24
+ ## 安装
25
+
26
+ ```bash
27
+ pip install -e /path/to/client/pip
28
+ # 或发布后
29
+ pip install qing-client
30
+ ```
31
+
32
+ ## 使用
33
+
34
+ ### 网关模式(前端/统一网关)
35
+
36
+ ```python
37
+ from qingclient import Client
38
+ from qingclient.types import ClientConfig
39
+
40
+ config = ClientConfig(
41
+ gateway_url="https://your-gateway.example.com",
42
+ project_id="your-project-id",
43
+ # 可选: org_id, app_id
44
+ )
45
+ client = Client(config)
46
+
47
+ # 登录后设置 token
48
+ res = client.auth.login("user", "password")
49
+ client.set_token(res.access_token)
50
+
51
+ # 调用各服务
52
+ user = client.user.get_current_user()
53
+ messages = client.msg.get_messages()
54
+ ```
55
+
56
+ ### 后端模式(直连各服务)
57
+
58
+ 直连时各服务 URL 需包含该服务在后端的路径前缀,例如 token 服务为 `.../api/token`,这样 path `/wxh5/accesstoken` 才会请求到正确的完整路径。详见根目录 [client/README.md](../README.md) 的「SDK 与现有架构对齐说明」。
59
+
60
+ ```python
61
+ from qingclient import Client
62
+ from qingclient.types import ClientConfig, UserContext
63
+
64
+ config = ClientConfig(
65
+ auth_service_url="http://auth-svc",
66
+ msg_service_url="http://msg-svc",
67
+ user_service_url="http://user-svc",
68
+ token_service_url="http://token-svc/api/token", # 含路径前缀
69
+ # ... 其他服务 URL
70
+ )
71
+ client = Client(config)
72
+
73
+ # 设置用户上下文(模拟请求方)
74
+ client.set_user_context(UserContext(
75
+ user_id="uid",
76
+ role="ADMIN",
77
+ project_id="pid",
78
+ ))
79
+
80
+ # 调用服务
81
+ messages = client.msg.get_messages()
82
+ ```
83
+
84
+ ### 服务列表(与 npm 一致)
85
+
86
+ - `client.auth` - 认证
87
+ - `client.msg` - 消息
88
+ - `client.user` - 用户
89
+ - `client.token` - Token 中控(公众号/小程序 access_token、jsapi_ticket、签名、小程序登录与获取手机号等)
90
+ - `client.file` - 文件
91
+ - `client.ai` - AI 对话
92
+ - `client.aigc` - AIGC
93
+ - `client.provider` - 提供商
94
+ - `client.usage` - 用量
95
+ - `client.audit` - 审计日志
96
+ - `client.fronthost` - 前端托管
97
+ - `client.org` - 组织
98
+ - `client.delivery_stream` - 投递流
99
+ - `client.ez_ability` - Ez 能力
100
+ - `client.im` - IM
101
+ - `client.hub` - 能力枢纽
102
+ - `client.task` - 任务
103
+
104
+ ## 版本
105
+
106
+ 与 npm 包版本号对齐,见 `pyproject.toml` / setuptools-scm 或根目录 client 版本说明。
@@ -0,0 +1,64 @@
1
+ README.md
2
+ pyproject.toml
3
+ setup.py
4
+ ./qingclient/__init__.py
5
+ ./qingclient/_version.py
6
+ ./qingclient/ai_service.py
7
+ ./qingclient/aigc_service.py
8
+ ./qingclient/audit_service.py
9
+ ./qingclient/auth_service.py
10
+ ./qingclient/base_client.py
11
+ ./qingclient/client.py
12
+ ./qingclient/delivery_stream_service.py
13
+ ./qingclient/ez_ability_service.py
14
+ ./qingclient/file_service.py
15
+ ./qingclient/fronthost_service.py
16
+ ./qingclient/hub_service.py
17
+ ./qingclient/im_service.py
18
+ ./qingclient/msg_service.py
19
+ ./qingclient/org_service.py
20
+ ./qingclient/provider_service.py
21
+ ./qingclient/task_service.py
22
+ ./qingclient/token_service.py
23
+ ./qingclient/usage_service.py
24
+ ./qingclient/user_service.py
25
+ ./qingclient/types/__init__.py
26
+ ./qingclient/types/auth.py
27
+ ./qingclient/types/base.py
28
+ ./qingclient/types/config.py
29
+ ./qingclient/types/msg.py
30
+ ./qingclient/types/token.py
31
+ ./qingclient/types/user.py
32
+ qing_client.egg-info/PKG-INFO
33
+ qing_client.egg-info/SOURCES.txt
34
+ qing_client.egg-info/dependency_links.txt
35
+ qing_client.egg-info/requires.txt
36
+ qing_client.egg-info/top_level.txt
37
+ qingclient/__init__.py
38
+ qingclient/_version.py
39
+ qingclient/ai_service.py
40
+ qingclient/aigc_service.py
41
+ qingclient/audit_service.py
42
+ qingclient/auth_service.py
43
+ qingclient/base_client.py
44
+ qingclient/client.py
45
+ qingclient/delivery_stream_service.py
46
+ qingclient/ez_ability_service.py
47
+ qingclient/file_service.py
48
+ qingclient/fronthost_service.py
49
+ qingclient/hub_service.py
50
+ qingclient/im_service.py
51
+ qingclient/msg_service.py
52
+ qingclient/org_service.py
53
+ qingclient/provider_service.py
54
+ qingclient/task_service.py
55
+ qingclient/token_service.py
56
+ qingclient/usage_service.py
57
+ qingclient/user_service.py
58
+ qingclient/types/__init__.py
59
+ qingclient/types/auth.py
60
+ qingclient/types/base.py
61
+ qingclient/types/config.py
62
+ qingclient/types/msg.py
63
+ qingclient/types/token.py
64
+ qingclient/types/user.py
@@ -0,0 +1,7 @@
1
+ requests>=2.28.0
2
+
3
+ [dev]
4
+ pytest>=7.0
5
+ pytest-asyncio>=0.20.0
6
+ twine>=4.0.0
7
+ build>=0.10.0
@@ -0,0 +1 @@
1
+ qingclient
@@ -0,0 +1,49 @@
1
+ """
2
+ Qing 平台统一 SDK - Python 客户端(与 npm 版 qing-client 对齐)。
3
+ """
4
+ from ._version import __version__
5
+ from .client import Client
6
+ from .base_client import BaseClient
7
+ from . import types
8
+
9
+ from .auth_service import AuthService
10
+ from .msg_service import MsgService
11
+ from .user_service import UserService
12
+ from .token_service import TokenService
13
+ from .file_service import FileService
14
+ from .ai_service import AiService
15
+ from .aigc_service import AigcService
16
+ from .provider_service import ProviderService
17
+ from .usage_service import UsageService
18
+ from .audit_service import AuditLogService
19
+ from .fronthost_service import FrontHostService
20
+ from .org_service import OrgService
21
+ from .delivery_stream_service import DeliveryStreamService
22
+ from .ez_ability_service import EzAbilityService
23
+ from .im_service import ImService
24
+ from .hub_service import HubService
25
+ from .task_service import TaskService
26
+
27
+ __all__ = [
28
+ "__version__",
29
+ "Client",
30
+ "BaseClient",
31
+ "AuthService",
32
+ "MsgService",
33
+ "UserService",
34
+ "TokenService",
35
+ "FileService",
36
+ "AiService",
37
+ "AigcService",
38
+ "ProviderService",
39
+ "UsageService",
40
+ "AuditLogService",
41
+ "FrontHostService",
42
+ "OrgService",
43
+ "DeliveryStreamService",
44
+ "EzAbilityService",
45
+ "ImService",
46
+ "HubService",
47
+ "TaskService",
48
+ "types",
49
+ ]
@@ -0,0 +1,34 @@
1
+ # file generated by setuptools-scm
2
+ # don't change, don't track in version control
3
+
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
12
+
13
+ TYPE_CHECKING = False
14
+ if TYPE_CHECKING:
15
+ from typing import Tuple
16
+ from typing import Union
17
+
18
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
20
+ else:
21
+ VERSION_TUPLE = object
22
+ COMMIT_ID = object
23
+
24
+ version: str
25
+ __version__: str
26
+ __version_tuple__: VERSION_TUPLE
27
+ version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
30
+
31
+ __version__ = version = '0.0.0'
32
+ __version_tuple__ = version_tuple = (0, 0, 0)
33
+
34
+ __commit_id__ = commit_id = None
@@ -0,0 +1,91 @@
1
+ """AI 服务(与 npm AiService 对齐)。"""
2
+ from typing import Any, Optional
3
+
4
+ from .base_client import BaseClient
5
+ from .types import ClientConfig, RequestOptions, TokenStorage
6
+
7
+
8
+ class AiService(BaseClient):
9
+ service_path = "ai"
10
+
11
+ def __init__(
12
+ self,
13
+ config: ClientConfig,
14
+ token_storage: Optional[TokenStorage] = None,
15
+ ) -> None:
16
+ super().__init__(config, token_storage=token_storage)
17
+
18
+ @property
19
+ def service_name(self) -> str:
20
+ return "ai"
21
+
22
+ def chat_completion(
23
+ self,
24
+ request: dict,
25
+ options: Optional[RequestOptions] = None,
26
+ ) -> Any:
27
+ return self.request("/chat", RequestOptions(method="POST", body=request))
28
+
29
+ def chat_completion_stream(
30
+ self,
31
+ request: dict,
32
+ options: Optional[RequestOptions] = None,
33
+ ) -> Any:
34
+ return self.request("/chat/stream", RequestOptions(method="POST", body=request))
35
+
36
+ def create_session(
37
+ self,
38
+ request: dict,
39
+ options: Optional[RequestOptions] = None,
40
+ ) -> Any:
41
+ return self.request("/session", RequestOptions(method="POST", body=request))
42
+
43
+ def get_sessions(
44
+ self,
45
+ params: Optional[dict] = None,
46
+ options: Optional[RequestOptions] = None,
47
+ ) -> Any:
48
+ return self.request("/session", RequestOptions(
49
+ method="GET",
50
+ params=params or {},
51
+ ))
52
+
53
+ def get_session(
54
+ self,
55
+ session_id: str,
56
+ options: Optional[RequestOptions] = None,
57
+ ) -> Any:
58
+ return self.request(f"/session/{session_id}", RequestOptions(method="GET"))
59
+
60
+ def update_session(
61
+ self,
62
+ session_id: str,
63
+ update_data: dict,
64
+ options: Optional[RequestOptions] = None,
65
+ ) -> Any:
66
+ return self.request(f"/session/{session_id}", RequestOptions(
67
+ method="PUT",
68
+ body=update_data,
69
+ ))
70
+
71
+ def add_message(
72
+ self,
73
+ session_id: str,
74
+ request: dict,
75
+ options: Optional[RequestOptions] = None,
76
+ ) -> Any:
77
+ return self.request(f"/session/{session_id}/messages", RequestOptions(
78
+ method="POST",
79
+ body=request,
80
+ ))
81
+
82
+ def switch_model(
83
+ self,
84
+ session_id: str,
85
+ request: dict,
86
+ options: Optional[RequestOptions] = None,
87
+ ) -> Any:
88
+ return self.request(f"/session/{session_id}/switch-model", RequestOptions(
89
+ method="POST",
90
+ body=request,
91
+ ))
@@ -0,0 +1,41 @@
1
+ """AIGC 服务(与 npm AigcService 对齐)。"""
2
+ from typing import Any, Optional
3
+
4
+ from .base_client import BaseClient
5
+ from .types import ClientConfig, RequestOptions, TokenStorage
6
+
7
+
8
+ class AigcService(BaseClient):
9
+ service_path = "aigc"
10
+
11
+ def __init__(
12
+ self,
13
+ config: ClientConfig,
14
+ token_storage: Optional[TokenStorage] = None,
15
+ ) -> None:
16
+ super().__init__(config, token_storage=token_storage)
17
+
18
+ @property
19
+ def service_name(self) -> str:
20
+ return "aigc"
21
+
22
+ def text_generation(
23
+ self,
24
+ request: dict,
25
+ options: Optional[RequestOptions] = None,
26
+ ) -> Any:
27
+ return self.request("/text/generate", RequestOptions(method="POST", body=request))
28
+
29
+ def image_generation(
30
+ self,
31
+ request: dict,
32
+ options: Optional[RequestOptions] = None,
33
+ ) -> Any:
34
+ return self.request("/image/generate", RequestOptions(method="POST", body=request))
35
+
36
+ def get_task_status(
37
+ self,
38
+ task_id: str,
39
+ options: Optional[RequestOptions] = None,
40
+ ) -> Any:
41
+ return self.request(f"/task/{task_id}/status", RequestOptions(method="GET"))
@@ -0,0 +1,37 @@
1
+ """审计日志服务(与 npm AuditLogService 对齐,servicePath: logs)。"""
2
+ from typing import Any, Optional
3
+
4
+ from .base_client import BaseClient
5
+ from .types import ClientConfig, RequestOptions, TokenStorage, PaginatedResponse
6
+
7
+
8
+ class AuditLogService(BaseClient):
9
+ service_path = "logs"
10
+
11
+ def __init__(
12
+ self,
13
+ config: ClientConfig,
14
+ token_storage: Optional[TokenStorage] = None,
15
+ ) -> None:
16
+ super().__init__(config, token_storage=token_storage)
17
+
18
+ @property
19
+ def service_name(self) -> str:
20
+ return "audit"
21
+
22
+ def list_logs(
23
+ self,
24
+ params: Optional[dict] = None,
25
+ options: Optional[RequestOptions] = None,
26
+ ) -> Any:
27
+ return self.request("", RequestOptions(
28
+ method="GET",
29
+ params=params or {},
30
+ ))
31
+
32
+ def create_test_log(
33
+ self,
34
+ request: dict,
35
+ options: Optional[RequestOptions] = None,
36
+ ) -> Any:
37
+ return self.request("/test", RequestOptions(method="POST", body=request))