-
-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathapi_aily_aily_session_run_create.go
More file actions
106 lines (94 loc) · 6.19 KB
/
Copy pathapi_aily_aily_session_run_create.go
File metadata and controls
106 lines (94 loc) · 6.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Code generated by lark_sdk_gen. DO NOT EDIT.
/**
* Copyright 2022 chyroc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lark
import (
"context"
)
// CreateAilySessionRun 该 API 用于在某个飞书 Aily 应用会话(Session)上创建一次运行(Run)。
//
// 更多信息及示例代码, 可参考 [Aily OpenAPI 接入与接口说明](https://bytedance.larkoffice.com/wiki/UTU6wVTVGigefykjO1acAOOvnNc)。
// ## 实体概念说明
// - 会话(Session): 管理用户与 Aily 助手之间的交互会话;每次会话记录了用户发送给 Aily 助手的消息以及 Aily 助手的响应。
// - 消息(Message): 消息可以包含文本、表格、图片等多种类型的内容。
// - 运行(Run): Aily 助手基于会话内消息进行意图判定、调用匹配的技能, 并返回技能执行后的结果消息。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/aily-v1/aily_session-run/create
// new doc: https://open.feishu.cn/document/aily-v1/aily_session-run/create
func (r *AilyService) CreateAilySessionRun(ctx context.Context, request *CreateAilySessionRunReq, options ...MethodOptionFunc) (*CreateAilySessionRunResp, *Response, error) {
if r.cli.mock.mockAilyCreateAilySessionRun != nil {
r.cli.Log(ctx, LogLevelDebug, "[lark] Aily#CreateAilySessionRun mock enable")
return r.cli.mock.mockAilyCreateAilySessionRun(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Aily",
API: "CreateAilySessionRun",
Method: "POST",
URL: r.cli.openBaseURL + "/open-apis/aily/v1/sessions/:aily_session_id/runs",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
NeedUserAccessToken: true,
}
resp := new(createAilySessionRunResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
// MockAilyCreateAilySessionRun mock AilyCreateAilySessionRun method
func (r *Mock) MockAilyCreateAilySessionRun(f func(ctx context.Context, request *CreateAilySessionRunReq, options ...MethodOptionFunc) (*CreateAilySessionRunResp, *Response, error)) {
r.mockAilyCreateAilySessionRun = f
}
// UnMockAilyCreateAilySessionRun un-mock AilyCreateAilySessionRun method
func (r *Mock) UnMockAilyCreateAilySessionRun() {
r.mockAilyCreateAilySessionRun = nil
}
// CreateAilySessionRunReq ...
type CreateAilySessionRunReq struct {
XAilyBizUserID *string `header:"X-Aily-BizUserID" json:"-"` // 为标识创建会话的唯一用户 ID- 建议使用唯一内部 ID 或其他可标识用户唯一身份的字段(如飞书账号的 user_id), 可用于分析来自 API 的具体用户示例值: "ou_5ad573a6411d72b8305fda3a9c15c70e" 长度范围: `0` ~ `64` 字符
AilySessionID string `path:"aily_session_id" json:"-"` // 会话 ID;参考 [创建会话](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/aily-v1/aily_session/create) 接口示例值: "session_4dfunz7sp1g8m" 长度范围: `0` ~ `32` 字符- 正则校验: `session_[0-9a-hjkmnp-z]{1, 24}`
AppID string `json:"app_id,omitempty"` // 为 Aily 应用 ID(`spring_xxx__c`), 可以在 Aily 应用开发页面的浏览器地址里获取示例值: "spring_449d72db2f__c" 长度范围: `0` ~ `64` 字符
SkillID *string `json:"skill_id,omitempty"` // 指定技能 ID(`skill_xxx`), 可以在 Aily 技能配置页面的浏览器地址里获取> 指定技能后、能够节省意图匹配的耗时示例值: "skill_6cc6166178ca" 长度范围: `0` ~ `32` 字符
SkillInput *string `json:"skill_input,omitempty"` // 指定技能 ID 时可以同时指定技能输入> 备注: 常用于工作流技能内指定自定义参数, `skill_input` 需要配合 `skill_id` 同时传递才能生效示例值: "{\"key\": \"value\"}" 长度范围: `0` ~ `255` 字符
Metadata *string `json:"metadata,omitempty"` // 其他扩展的参数(JSON String)> 备注: `metadata` 传递的参数, 可以在后续 `GetRun` 调用中原样读取获得示例值: "{}" 长度范围: `0` ~ `255` 字符
}
// CreateAilySessionRunResp ...
type CreateAilySessionRunResp struct {
Run *CreateAilySessionRunRespRun `json:"run,omitempty"` // 运行信息
}
// CreateAilySessionRunRespRun ...
type CreateAilySessionRunRespRun struct {
ID string `json:"id,omitempty"` // 运行 ID
CreatedAt string `json:"created_at,omitempty"` // 运行的创建时间, 毫秒时间戳
AppID string `json:"app_id,omitempty"` // 应用 ID
SessionID string `json:"session_id,omitempty"` // 会话 ID
Status string `json:"status,omitempty"` // 状态
StartedAt string `json:"started_at,omitempty"` // 开始时间, 毫秒时间戳
EndedAt string `json:"ended_at,omitempty"` // 结束时间, 毫秒时间戳
Error *CreateAilySessionRunRespRunError `json:"error,omitempty"` // 失败时的错误信息
Metadata string `json:"metadata,omitempty"` // 其他透传信息
}
// CreateAilySessionRunRespRunError ...
type CreateAilySessionRunRespRunError struct {
Code string `json:"code,omitempty"` // 错误码
Message string `json:"message,omitempty"` // 错误信息
}
// createAilySessionRunResp ...
type createAilySessionRunResp struct {
Code int64 `json:"code,omitempty"` // 错误码, 非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *CreateAilySessionRunResp `json:"data,omitempty"`
Error *ErrorDetail `json:"error,omitempty"`
}