Skip to content

Commit 8c523d5

Browse files
hannengfanghonglei24
authored andcommitted
feat(chat-api): add api 「get_opening_config」and 「query_message_oauth_status」.
1 parent e13fa30 commit 8c523d5

File tree

3 files changed

+114
-2
lines changed

3 files changed

+114
-2
lines changed

libs/api/hiagent_api/chat.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@
7575
ToolMessageOutputStartWorkflowEvent, ToolMessageWorkflowEvent, FlowCostWorkflowEvent, FlowInterruptedWorkflowEvent,
7676
MessageOutputStartWorkflowEvent, MessageOutputEndWorkflowEvent, MessageWorkflowEvent, GetAppUserVariablesRequest,
7777
GetAppUserVariablesResponse, SetAppUserVariablesRequest, QueryTriggerRunRecordsRequest,
78-
QueryTriggerRunRecordsResponse,
78+
QueryTriggerRunRecordsResponse, GetOpeningConfigOpenRequest, GetOpeningConfigOpenResponse,
79+
QueryAppMessageOauthStatusOpenRequest, QueryAppMessageOauthStatusResponse
7980
)
8081

8182

@@ -849,6 +850,46 @@ async def aquery_trigger_run_records(
849850
by_alias=True,
850851
)
851852

853+
def query_message_oauth_status(
854+
self, app_key: str, req: QueryAppMessageOauthStatusOpenRequest
855+
) -> QueryAppMessageOauthStatusResponse:
856+
return QueryAppMessageOauthStatusResponse.model_validate_json(
857+
self._post(
858+
app_key, "query_message_oauth_status", req.model_dump(by_alias=True)
859+
),
860+
by_alias=True,
861+
)
862+
863+
async def aquery_message_oauth_status(
864+
self, app_key: str, req: QueryAppMessageOauthStatusOpenRequest
865+
) -> QueryAppMessageOauthStatusResponse:
866+
return QueryAppMessageOauthStatusResponse.model_validate_json(
867+
await self._apost(
868+
app_key, "query_message_oauth_status", req.model_dump(by_alias=True)
869+
),
870+
by_alias=True,
871+
)
872+
873+
def get_opening_config(
874+
self, app_key: str, req: GetOpeningConfigOpenRequest
875+
) -> GetOpeningConfigOpenResponse:
876+
return GetOpeningConfigOpenResponse.model_validate_json(
877+
self._post(
878+
app_key, "get_opening_config", req.model_dump(by_alias=True)
879+
),
880+
by_alias=True,
881+
)
882+
883+
async def aget_opening_config(
884+
self, app_key: str, req: GetOpeningConfigOpenRequest
885+
) -> GetOpeningConfigOpenResponse:
886+
return GetOpeningConfigOpenResponse.model_validate_json(
887+
await self._apost(
888+
app_key, "get_opening_config", req.model_dump(by_alias=True)
889+
),
890+
by_alias=True,
891+
)
892+
852893

853894
def parse_chat_event(event_data: dict) -> Optional[ChatEvent]:
854895
match event_data["event"]:

libs/api/hiagent_api/chat_types.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,7 @@ class GetConversationListResponse(BaseSchema):
824824
default=[],
825825
)
826826

827+
827828
class GetConversationInputsRequest(BaseSchema):
828829
app_key: str = Field(
829830
description="app key",
@@ -2008,6 +2009,7 @@ class TriggerConfig(BaseSchema):
20082009
default=[],
20092010
)
20102011

2012+
20112013
class TriggerRunRecord(BaseSchema):
20122014
run_id: str = Field(
20132015
description="run id",
@@ -2067,3 +2069,72 @@ class QueryTriggerRunRecordsResponse(BaseSchema):
20672069
validation_alias="records",
20682070
default=[],
20692071
)
2072+
2073+
2074+
class GetOpeningConfigOpenRequest(BaseSchema):
2075+
app_key: str = Field(
2076+
description="app key",
2077+
serialization_alias="AppKey",
2078+
)
2079+
user_id: str = Field(
2080+
description="user id",
2081+
serialization_alias="UserID",
2082+
)
2083+
user_type: Optional[str] = Field(
2084+
description="user type, App:openapi user;IAM:hiagent user;Visitor:web user;Lark:lark user;Wechat: wechat user",
2085+
serialization_alias="UserType",
2086+
default=None,
2087+
)
2088+
app_conversation_id: str = Field(
2089+
description="conversation id",
2090+
serialization_alias="AppConversationID",
2091+
default="",
2092+
)
2093+
2094+
2095+
class OpeningConfig(BaseSchema):
2096+
opening_text: Optional[str] = Field(
2097+
description="opening text",
2098+
validation_alias="OpeningText",
2099+
default="",
2100+
)
2101+
opening_questions: list[str] = Field(
2102+
description="opening questions",
2103+
validation_alias="OpeningQuestions",
2104+
default=[],
2105+
)
2106+
opening_enabled: bool = Field(
2107+
description="opening enabled",
2108+
validation_alias="OpeningEnabled",
2109+
default=False,
2110+
)
2111+
2112+
2113+
class GetOpeningConfigOpenResponse(BaseSchema):
2114+
opening_config: Optional[OpeningConfig] = Field(
2115+
description="opening config",
2116+
validation_alias="OpeningConfig",
2117+
default=None,
2118+
)
2119+
2120+
2121+
class QueryAppMessageOauthStatusOpenRequest(BaseSchema):
2122+
app_key: str = Field(
2123+
description="app key",
2124+
serialization_alias="AppKey",
2125+
)
2126+
user_id: str = Field(
2127+
description="user id",
2128+
serialization_alias="UserID",
2129+
)
2130+
message_id: str = Field(
2131+
description="message id",
2132+
serialization_alias="MessageID",
2133+
)
2134+
2135+
2136+
class QueryAppMessageOauthStatusResponse(BaseSchema):
2137+
status: str = Field(
2138+
description="status: NOT_FOUND, PROCESSING, SUCCEED, STOPPED, FINISHED",
2139+
validation_alias="Status"
2140+
)

libs/api/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "hiagent-api"
3-
version = "2.3.1"
3+
version = "2.4.0"
44
description = "Add your description here"
55
readme = "README.md"
66
requires-python = ">=3.10"

0 commit comments

Comments
 (0)