Skip to content

Commit d7a73bc

Browse files
feat(api): api update
1 parent b22320b commit d7a73bc

File tree

6 files changed

+108
-10
lines changed

6 files changed

+108
-10
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 96
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-ac5ecff5cf03e9713d63470d36dd93cb6c7d466a516bd85e5ec4548c0933b398.yml
3-
openapi_spec_hash: 8f4e83f3dcefba7a1b451b6949b78539
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-3e1e26e4e4e25828b277b8b446dffd813a5ef1391e62880b526c16a7cd7622ef.yml
3+
openapi_spec_hash: dce6087693b8f3758dfc694c7e1b1c7a
44
config_hash: a572ab842ea60ce13f1d1a1358440cbe

src/asktable/resources/bots.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Optional
5+
from typing import List, Iterable, Optional
66

77
import httpx
88

@@ -52,6 +52,7 @@ def create(
5252
color_theme: Optional[str] | NotGiven = NOT_GIVEN,
5353
debug: bool | NotGiven = NOT_GIVEN,
5454
extapi_ids: List[str] | NotGiven = NOT_GIVEN,
55+
interaction_rules: Iterable[bot_create_params.InteractionRule] | NotGiven = NOT_GIVEN,
5556
magic_input: Optional[str] | NotGiven = NOT_GIVEN,
5657
max_rows: int | NotGiven = NOT_GIVEN,
5758
publish: bool | NotGiven = NOT_GIVEN,
@@ -80,6 +81,8 @@ def create(
8081
8182
extapi_ids: 扩展 API ID 列表,扩展 API ID 的逗号分隔列表。
8283
84+
interaction_rules: 交互规则列表,用于定义 bot 的行为规则
85+
8386
magic_input: 魔法提示词
8487
8588
max_rows: 最大返回行数,默认不限制
@@ -111,6 +114,7 @@ def create(
111114
"color_theme": color_theme,
112115
"debug": debug,
113116
"extapi_ids": extapi_ids,
117+
"interaction_rules": interaction_rules,
114118
"magic_input": magic_input,
115119
"max_rows": max_rows,
116120
"publish": publish,
@@ -169,6 +173,7 @@ def update(
169173
datasource_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
170174
debug: Optional[bool] | NotGiven = NOT_GIVEN,
171175
extapi_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
176+
interaction_rules: Optional[Iterable[bot_update_params.InteractionRule]] | NotGiven = NOT_GIVEN,
172177
magic_input: Optional[str] | NotGiven = NOT_GIVEN,
173178
max_rows: Optional[int] | NotGiven = NOT_GIVEN,
174179
name: Optional[str] | NotGiven = NOT_GIVEN,
@@ -198,6 +203,8 @@ def update(
198203
199204
extapi_ids: 扩展 API ID 列表,扩展 API ID 的逗号分隔列表。
200205
206+
interaction_rules: 交互规则列表,用于定义 bot 的行为规则
207+
201208
magic_input: 魔法提示词
202209
203210
max_rows: 最大返回行数,默认不限制
@@ -233,6 +240,7 @@ def update(
233240
"datasource_ids": datasource_ids,
234241
"debug": debug,
235242
"extapi_ids": extapi_ids,
243+
"interaction_rules": interaction_rules,
236244
"magic_input": magic_input,
237245
"max_rows": max_rows,
238246
"name": name,
@@ -405,6 +413,7 @@ async def create(
405413
color_theme: Optional[str] | NotGiven = NOT_GIVEN,
406414
debug: bool | NotGiven = NOT_GIVEN,
407415
extapi_ids: List[str] | NotGiven = NOT_GIVEN,
416+
interaction_rules: Iterable[bot_create_params.InteractionRule] | NotGiven = NOT_GIVEN,
408417
magic_input: Optional[str] | NotGiven = NOT_GIVEN,
409418
max_rows: int | NotGiven = NOT_GIVEN,
410419
publish: bool | NotGiven = NOT_GIVEN,
@@ -433,6 +442,8 @@ async def create(
433442
434443
extapi_ids: 扩展 API ID 列表,扩展 API ID 的逗号分隔列表。
435444
445+
interaction_rules: 交互规则列表,用于定义 bot 的行为规则
446+
436447
magic_input: 魔法提示词
437448
438449
max_rows: 最大返回行数,默认不限制
@@ -464,6 +475,7 @@ async def create(
464475
"color_theme": color_theme,
465476
"debug": debug,
466477
"extapi_ids": extapi_ids,
478+
"interaction_rules": interaction_rules,
467479
"magic_input": magic_input,
468480
"max_rows": max_rows,
469481
"publish": publish,
@@ -522,6 +534,7 @@ async def update(
522534
datasource_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
523535
debug: Optional[bool] | NotGiven = NOT_GIVEN,
524536
extapi_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
537+
interaction_rules: Optional[Iterable[bot_update_params.InteractionRule]] | NotGiven = NOT_GIVEN,
525538
magic_input: Optional[str] | NotGiven = NOT_GIVEN,
526539
max_rows: Optional[int] | NotGiven = NOT_GIVEN,
527540
name: Optional[str] | NotGiven = NOT_GIVEN,
@@ -551,6 +564,8 @@ async def update(
551564
552565
extapi_ids: 扩展 API ID 列表,扩展 API ID 的逗号分隔列表。
553566
567+
interaction_rules: 交互规则列表,用于定义 bot 的行为规则
568+
554569
magic_input: 魔法提示词
555570
556571
max_rows: 最大返回行数,默认不限制
@@ -586,6 +601,7 @@ async def update(
586601
"datasource_ids": datasource_ids,
587602
"debug": debug,
588603
"extapi_ids": extapi_ids,
604+
"interaction_rules": interaction_rules,
589605
"magic_input": magic_input,
590606
"max_rows": max_rows,
591607
"name": name,

src/asktable/types/bot_create_params.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Optional
6-
from typing_extensions import Required, TypedDict
5+
from typing import List, Iterable, Optional
6+
from typing_extensions import Literal, Required, TypedDict
77

8-
__all__ = ["BotCreateParams"]
8+
__all__ = ["BotCreateParams", "InteractionRule"]
99

1010

1111
class BotCreateParams(TypedDict, total=False):
@@ -24,6 +24,9 @@ class BotCreateParams(TypedDict, total=False):
2424
extapi_ids: List[str]
2525
"""扩展 API ID 列表,扩展 API ID 的逗号分隔列表。"""
2626

27+
interaction_rules: Iterable[InteractionRule]
28+
"""交互规则列表,用于定义 bot 的行为规则"""
29+
2730
magic_input: Optional[str]
2831
"""魔法提示词"""
2932

@@ -44,3 +47,15 @@ class BotCreateParams(TypedDict, total=False):
4447

4548
welcome_message: Optional[str]
4649
"""欢迎消息"""
50+
51+
52+
class InteractionRule(TypedDict, total=False):
53+
enabled: Required[bool]
54+
55+
message: Required[str]
56+
57+
name: Required[str]
58+
59+
version: Required[Literal["1.0.0"]]
60+
61+
words: Required[List[str]]

src/asktable/types/bot_update_params.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Optional
6-
from typing_extensions import TypedDict
5+
from typing import List, Iterable, Optional
6+
from typing_extensions import Literal, Required, TypedDict
77

8-
__all__ = ["BotUpdateParams"]
8+
__all__ = ["BotUpdateParams", "InteractionRule"]
99

1010

1111
class BotUpdateParams(TypedDict, total=False):
@@ -24,6 +24,9 @@ class BotUpdateParams(TypedDict, total=False):
2424
extapi_ids: Optional[List[str]]
2525
"""扩展 API ID 列表,扩展 API ID 的逗号分隔列表。"""
2626

27+
interaction_rules: Optional[Iterable[InteractionRule]]
28+
"""交互规则列表,用于定义 bot 的行为规则"""
29+
2730
magic_input: Optional[str]
2831
"""魔法提示词"""
2932

@@ -47,3 +50,15 @@ class BotUpdateParams(TypedDict, total=False):
4750

4851
welcome_message: Optional[str]
4952
"""欢迎消息"""
53+
54+
55+
class InteractionRule(TypedDict, total=False):
56+
enabled: Required[bool]
57+
58+
message: Required[str]
59+
60+
name: Required[str]
61+
62+
version: Required[Literal["1.0.0"]]
63+
64+
words: Required[List[str]]

src/asktable/types/chatbot.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,23 @@
22

33
from typing import List, Optional
44
from datetime import datetime
5+
from typing_extensions import Literal
56

67
from .._models import BaseModel
78

8-
__all__ = ["Chatbot"]
9+
__all__ = ["Chatbot", "InteractionRule"]
10+
11+
12+
class InteractionRule(BaseModel):
13+
enabled: bool
14+
15+
message: str
16+
17+
name: str
18+
19+
version: Literal["1.0.0"]
20+
21+
words: List[str]
922

1023

1124
class Chatbot(BaseModel):
@@ -35,6 +48,9 @@ class Chatbot(BaseModel):
3548
extapi_ids: Optional[List[str]] = None
3649
"""扩展 API ID 列表,扩展 API ID 的逗号分隔列表。"""
3750

51+
interaction_rules: Optional[List[InteractionRule]] = None
52+
"""交互规则列表,用于定义 bot 的行为规则"""
53+
3854
magic_input: Optional[str] = None
3955
"""魔法提示词"""
4056

tests/api_resources/test_bots.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ def test_method_create_with_all_params(self, client: Asktable) -> None:
3434
color_theme="default",
3535
debug=True,
3636
extapi_ids=["string"],
37+
interaction_rules=[
38+
{
39+
"enabled": True,
40+
"message": "抱歉,您的消息包含不当内容",
41+
"name": "blocked_words_rule",
42+
"version": "1.0.0",
43+
"words": ["敏感词1", "敏感词2"],
44+
}
45+
],
3746
magic_input="magic_input",
3847
max_rows=50,
3948
publish=True,
@@ -124,6 +133,15 @@ def test_method_update_with_all_params(self, client: Asktable) -> None:
124133
datasource_ids=["ds_sJAbnNOUzu3R4DdCCOwe"],
125134
debug=True,
126135
extapi_ids=["string"],
136+
interaction_rules=[
137+
{
138+
"enabled": True,
139+
"message": "抱歉,您的消息包含不当内容",
140+
"name": "blocked_words_rule",
141+
"version": "1.0.0",
142+
"words": ["敏感词1", "敏感词2"],
143+
}
144+
],
127145
magic_input="magic_input",
128146
max_rows=50,
129147
name="name",
@@ -301,6 +319,15 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable)
301319
color_theme="default",
302320
debug=True,
303321
extapi_ids=["string"],
322+
interaction_rules=[
323+
{
324+
"enabled": True,
325+
"message": "抱歉,您的消息包含不当内容",
326+
"name": "blocked_words_rule",
327+
"version": "1.0.0",
328+
"words": ["敏感词1", "敏感词2"],
329+
}
330+
],
304331
magic_input="magic_input",
305332
max_rows=50,
306333
publish=True,
@@ -391,6 +418,15 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable)
391418
datasource_ids=["ds_sJAbnNOUzu3R4DdCCOwe"],
392419
debug=True,
393420
extapi_ids=["string"],
421+
interaction_rules=[
422+
{
423+
"enabled": True,
424+
"message": "抱歉,您的消息包含不当内容",
425+
"name": "blocked_words_rule",
426+
"version": "1.0.0",
427+
"words": ["敏感词1", "敏感词2"],
428+
}
429+
],
394430
magic_input="magic_input",
395431
max_rows=50,
396432
name="name",

0 commit comments

Comments
 (0)