mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 03:32:23 +08:00
feat(Tools): add lark tools (#10117)
Co-authored-by: 黎斌 <libin.23@bytedance.com>
This commit is contained in:
parent
59f8d116af
commit
f562a88249
|
@ -48,6 +48,13 @@
|
|||
- feishu_task
|
||||
- feishu_calendar
|
||||
- feishu_spreadsheet
|
||||
- lark_base
|
||||
- lark_document
|
||||
- lark_message_and_group
|
||||
- lark_wiki
|
||||
- lark_task
|
||||
- lark_calendar
|
||||
- lark_spreadsheet
|
||||
- slack
|
||||
- twilio
|
||||
- wecom
|
||||
|
|
|
@ -34,7 +34,7 @@ parameters:
|
|||
Page size, default value: 20, maximum value: 100.
|
||||
zh_Hans: 分页大小,默认值:20,最大值:100。
|
||||
llm_description: 分页大小,默认值:20,最大值:100。
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
|
|
|
@ -147,7 +147,7 @@ parameters:
|
|||
Page size, default value: 20, maximum value: 500.
|
||||
zh_Hans: 分页大小,默认值:20,最大值:500。
|
||||
llm_description: 分页大小,默认值:20,最大值:500。
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
|
|
|
@ -47,7 +47,7 @@ parameters:
|
|||
en_US: The page size, i.e., the number of data entries returned in a single request. The default value is 50, and the value range is [50,1000].
|
||||
zh_Hans: 分页大小,即单次请求所返回的数据条目数。默认值为 50,取值范围为 [50,1000]。
|
||||
llm_description: 分页大小,即单次请求所返回的数据条目数。默认值为 50,取值范围为 [50,1000]。
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
|
|
|
@ -85,7 +85,7 @@ parameters:
|
|||
en_US: The page size, i.e., the number of data entries returned in a single request. The default value is 20, and the value range is [10,100].
|
||||
zh_Hans: 分页大小,即单次请求所返回的数据条目数。默认值为 20,取值范围为 [10,100]。
|
||||
llm_description: 分页大小,即单次请求所返回的数据条目数。默认值为 20,取值范围为 [10,100]。
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
|
|
|
@ -59,7 +59,7 @@ parameters:
|
|||
en_US: Paging size, the default and maximum value is 500.
|
||||
zh_Hans: 分页大小, 默认值和最大值为 500。
|
||||
llm_description: 分页大小, 表示一次请求最多返回多少条数据,默认值和最大值为 500。
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
|
|
|
@ -81,7 +81,7 @@ parameters:
|
|||
en_US: The page size, i.e., the number of data entries returned in a single request. The default value is 20, and the value range is [1,50].
|
||||
zh_Hans: 分页大小,即单次请求所返回的数据条目数。默认值为 20,取值范围为 [1,50]。
|
||||
llm_description: 分页大小,即单次请求所返回的数据条目数。默认值为 20,取值范围为 [1,50]。
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
|
|
|
@ -57,7 +57,7 @@ parameters:
|
|||
en_US: The page size, i.e., the number of data entries returned in a single request. The default value is 20, and the value range is [1,50].
|
||||
zh_Hans: 分页大小,即单次请求所返回的数据条目数。默认值为 20,取值范围为 [1,50]。
|
||||
llm_description: 分页大小,即单次请求所返回的数据条目数。默认值为 20,取值范围为 [1,50]。
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
|
|
|
@ -56,7 +56,7 @@ parameters:
|
|||
en_US: Number of columns to add, range (0-5000].
|
||||
zh_Hans: 要增加的列数,范围(0-5000]。
|
||||
llm_description: 要增加的列数,范围(0-5000]。
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: values
|
||||
type: string
|
||||
|
|
|
@ -56,7 +56,7 @@ parameters:
|
|||
en_US: Number of rows to add, range (0-5000].
|
||||
zh_Hans: 要增加行数,范围(0-5000]。
|
||||
llm_description: 要增加行数,范围(0-5000]。
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: values
|
||||
type: string
|
||||
|
|
|
@ -82,7 +82,7 @@ parameters:
|
|||
en_US: Starting column number, starting from 1.
|
||||
zh_Hans: 起始列号,从 1 开始。
|
||||
llm_description: 起始列号,从 1 开始。
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: num_cols
|
||||
type: number
|
||||
|
@ -94,4 +94,4 @@ parameters:
|
|||
en_US: Number of columns to read.
|
||||
zh_Hans: 读取列数
|
||||
llm_description: 读取列数
|
||||
form: llm
|
||||
form: form
|
||||
|
|
|
@ -82,7 +82,7 @@ parameters:
|
|||
en_US: Starting row number, starting from 1.
|
||||
zh_Hans: 起始行号,从 1 开始。
|
||||
llm_description: 起始行号,从 1 开始。
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: num_rows
|
||||
type: number
|
||||
|
@ -94,4 +94,4 @@ parameters:
|
|||
en_US: Number of rows to read.
|
||||
zh_Hans: 读取行数
|
||||
llm_description: 读取行数
|
||||
form: llm
|
||||
form: form
|
||||
|
|
|
@ -82,7 +82,7 @@ parameters:
|
|||
en_US: Starting row number, starting from 1.
|
||||
zh_Hans: 起始行号,从 1 开始。
|
||||
llm_description: 起始行号,从 1 开始。
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: num_rows
|
||||
type: number
|
||||
|
@ -94,7 +94,7 @@ parameters:
|
|||
en_US: Number of rows to read.
|
||||
zh_Hans: 读取行数
|
||||
llm_description: 读取行数
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: range
|
||||
type: string
|
||||
|
|
|
@ -36,7 +36,7 @@ parameters:
|
|||
en_US: The size of each page, with a maximum value of 50.
|
||||
zh_Hans: 分页大小,最大值 50。
|
||||
llm_description: 分页大小,最大值 50。
|
||||
form: llm
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
|
|
BIN
api/core/tools/provider/builtin/lark_base/_assets/icon.png
Normal file
BIN
api/core/tools/provider/builtin/lark_base/_assets/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
7
api/core/tools/provider/builtin/lark_base/lark_base.py
Normal file
7
api/core/tools/provider/builtin/lark_base/lark_base.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController
|
||||
from core.tools.utils.lark_api_utils import lark_auth
|
||||
|
||||
|
||||
class LarkBaseProvider(BuiltinToolProviderController):
|
||||
def _validate_credentials(self, credentials: dict) -> None:
|
||||
lark_auth(credentials)
|
36
api/core/tools/provider/builtin/lark_base/lark_base.yaml
Normal file
36
api/core/tools/provider/builtin/lark_base/lark_base.yaml
Normal file
|
@ -0,0 +1,36 @@
|
|||
identity:
|
||||
author: Doug Lea
|
||||
name: lark_base
|
||||
label:
|
||||
en_US: Lark Base
|
||||
zh_Hans: Lark 多维表格
|
||||
description:
|
||||
en_US: |
|
||||
Lark base, requires the following permissions: bitable:app.
|
||||
zh_Hans: |
|
||||
Lark 多维表格,需要开通以下权限: bitable:app。
|
||||
icon: icon.png
|
||||
tags:
|
||||
- social
|
||||
- productivity
|
||||
credentials_for_provider:
|
||||
app_id:
|
||||
type: text-input
|
||||
required: true
|
||||
label:
|
||||
en_US: APP ID
|
||||
placeholder:
|
||||
en_US: Please input your Lark app id
|
||||
zh_Hans: 请输入你的 Lark app id
|
||||
help:
|
||||
en_US: Get your app_id and app_secret from Lark
|
||||
zh_Hans: 从 Lark 获取您的 app_id 和 app_secret
|
||||
url: https://open.larksuite.com/app
|
||||
app_secret:
|
||||
type: secret-input
|
||||
required: true
|
||||
label:
|
||||
en_US: APP Secret
|
||||
placeholder:
|
||||
en_US: Please input your app secret
|
||||
zh_Hans: 请输入你的 Lark app secret
|
|
@ -0,0 +1,21 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class AddRecordsTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
app_token = tool_parameters.get("app_token")
|
||||
table_id = tool_parameters.get("table_id")
|
||||
table_name = tool_parameters.get("table_name")
|
||||
records = tool_parameters.get("records")
|
||||
user_id_type = tool_parameters.get("user_id_type", "open_id")
|
||||
|
||||
res = client.add_records(app_token, table_id, table_name, records, user_id_type)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,91 @@
|
|||
identity:
|
||||
name: add_records
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Add Records
|
||||
zh_Hans: 新增多条记录
|
||||
description:
|
||||
human:
|
||||
en_US: Add Multiple Records to Multidimensional Table
|
||||
zh_Hans: 在多维表格数据表中新增多条记录
|
||||
llm: A tool for adding multiple records to a multidimensional table. (在多维表格数据表中新增多条记录)
|
||||
parameters:
|
||||
- name: app_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: app_token
|
||||
zh_Hans: app_token
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table, supports inputting document URL.
|
||||
zh_Hans: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
llm_description: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
form: llm
|
||||
|
||||
- name: table_id
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: table_id
|
||||
zh_Hans: table_id
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table data, either table_id or table_name must be provided, cannot be empty simultaneously.
|
||||
zh_Hans: 多维表格数据表的唯一标识符,table_id 和 table_name 至少需要提供一个,不能同时为空。
|
||||
llm_description: 多维表格数据表的唯一标识符,table_id 和 table_name 至少需要提供一个,不能同时为空。
|
||||
form: llm
|
||||
|
||||
- name: table_name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: table_name
|
||||
zh_Hans: table_name
|
||||
human_description:
|
||||
en_US: Name of the multidimensional table data, either table_name or table_id must be provided, cannot be empty simultaneously.
|
||||
zh_Hans: 多维表格数据表的名称,table_name 和 table_id 至少需要提供一个,不能同时为空。
|
||||
llm_description: 多维表格数据表的名称,table_name 和 table_id 至少需要提供一个,不能同时为空。
|
||||
form: llm
|
||||
|
||||
- name: records
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: records
|
||||
zh_Hans: 记录列表
|
||||
human_description:
|
||||
en_US: |
|
||||
List of records to be added in this request. Example value: [{"multi-line-text":"text content","single_select":"option 1","date":1674206443000}]
|
||||
For supported field types, refer to the integration guide (https://open.larkoffice.com/document/server-docs/docs/bitable-v1/notification). For data structures of different field types, refer to the data structure overview (https://open.larkoffice.com/document/server-docs/docs/bitable-v1/bitable-structure).
|
||||
zh_Hans: |
|
||||
本次请求将要新增的记录列表,示例值:[{"多行文本":"文本内容","单选":"选项 1","日期":1674206443000}]。
|
||||
当前接口支持的字段类型请参考接入指南(https://open.larkoffice.com/document/server-docs/docs/bitable-v1/notification),不同类型字段的数据结构请参考数据结构概述(https://open.larkoffice.com/document/server-docs/docs/bitable-v1/bitable-structure)。
|
||||
llm_description: |
|
||||
本次请求将要新增的记录列表,示例值:[{"多行文本":"文本内容","单选":"选项 1","日期":1674206443000}]。
|
||||
当前接口支持的字段类型请参考接入指南(https://open.larkoffice.com/document/server-docs/docs/bitable-v1/notification),不同类型字段的数据结构请参考数据结构概述(https://open.larkoffice.com/document/server-docs/docs/bitable-v1/bitable-structure)。
|
||||
form: llm
|
||||
|
||||
- name: user_id_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: open_id
|
||||
label:
|
||||
en_US: open_id
|
||||
zh_Hans: open_id
|
||||
- value: union_id
|
||||
label:
|
||||
en_US: union_id
|
||||
zh_Hans: union_id
|
||||
- value: user_id
|
||||
label:
|
||||
en_US: user_id
|
||||
zh_Hans: user_id
|
||||
default: "open_id"
|
||||
label:
|
||||
en_US: user_id_type
|
||||
zh_Hans: 用户 ID 类型
|
||||
human_description:
|
||||
en_US: User ID type, optional values are open_id, union_id, user_id, with a default value of open_id.
|
||||
zh_Hans: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
llm_description: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
form: form
|
|
@ -0,0 +1,18 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class CreateBaseTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
name = tool_parameters.get("name")
|
||||
folder_token = tool_parameters.get("folder_token")
|
||||
|
||||
res = client.create_base(name, folder_token)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,42 @@
|
|||
identity:
|
||||
name: create_base
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Create Base
|
||||
zh_Hans: 创建多维表格
|
||||
description:
|
||||
human:
|
||||
en_US: Create Multidimensional Table in Specified Directory
|
||||
zh_Hans: 在指定目录下创建多维表格
|
||||
llm: A tool for creating a multidimensional table in a specified directory. (在指定目录下创建多维表格)
|
||||
parameters:
|
||||
- name: name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: name
|
||||
zh_Hans: 多维表格 App 名字
|
||||
human_description:
|
||||
en_US: |
|
||||
Name of the multidimensional table App. Example value: "A new multidimensional table".
|
||||
zh_Hans: 多维表格 App 名字,示例值:"一篇新的多维表格"。
|
||||
llm_description: 多维表格 App 名字,示例值:"一篇新的多维表格"。
|
||||
form: llm
|
||||
|
||||
- name: folder_token
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: folder_token
|
||||
zh_Hans: 多维表格 App 归属文件夹
|
||||
human_description:
|
||||
en_US: |
|
||||
Folder where the multidimensional table App belongs. Default is empty, meaning the table will be created in the root directory of the cloud space. Example values: Lf8uf6BoAlWkUfdGtpMjUV0PpZd or https://lark-japan.jp.larksuite.com/drive/folder/Lf8uf6BoAlWkUfdGtpMjUV0PpZd.
|
||||
The folder_token must be an existing folder and supports inputting folder token or folder URL.
|
||||
zh_Hans: |
|
||||
多维表格 App 归属文件夹。默认为空,表示多维表格将被创建在云空间根目录。示例值: Lf8uf6BoAlWkUfdGtpMjUV0PpZd 或者 https://lark-japan.jp.larksuite.com/drive/folder/Lf8uf6BoAlWkUfdGtpMjUV0PpZd。
|
||||
folder_token 必须是已存在的文件夹,支持输入文件夹 token 或者文件夹 URL。
|
||||
llm_description: |
|
||||
多维表格 App 归属文件夹。默认为空,表示多维表格将被创建在云空间根目录。示例值: Lf8uf6BoAlWkUfdGtpMjUV0PpZd 或者 https://lark-japan.jp.larksuite.com/drive/folder/Lf8uf6BoAlWkUfdGtpMjUV0PpZd。
|
||||
folder_token 必须是已存在的文件夹,支持输入文件夹 token 或者文件夹 URL。
|
||||
form: llm
|
|
@ -0,0 +1,20 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class CreateTableTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
app_token = tool_parameters.get("app_token")
|
||||
table_name = tool_parameters.get("table_name")
|
||||
default_view_name = tool_parameters.get("default_view_name")
|
||||
fields = tool_parameters.get("fields")
|
||||
|
||||
res = client.create_table(app_token, table_name, default_view_name, fields)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,61 @@
|
|||
identity:
|
||||
name: create_table
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Create Table
|
||||
zh_Hans: 新增数据表
|
||||
description:
|
||||
human:
|
||||
en_US: Add a Data Table to Multidimensional Table
|
||||
zh_Hans: 在多维表格中新增一个数据表
|
||||
llm: A tool for adding a data table to a multidimensional table. (在多维表格中新增一个数据表)
|
||||
parameters:
|
||||
- name: app_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: app_token
|
||||
zh_Hans: app_token
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table, supports inputting document URL.
|
||||
zh_Hans: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
llm_description: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
form: llm
|
||||
|
||||
- name: table_name
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Table Name
|
||||
zh_Hans: 数据表名称
|
||||
human_description:
|
||||
en_US: |
|
||||
The name of the data table, length range: 1 character to 100 characters.
|
||||
zh_Hans: 数据表名称,长度范围:1 字符 ~ 100 字符。
|
||||
llm_description: 数据表名称,长度范围:1 字符 ~ 100 字符。
|
||||
form: llm
|
||||
|
||||
- name: default_view_name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Default View Name
|
||||
zh_Hans: 默认表格视图的名称
|
||||
human_description:
|
||||
en_US: The name of the default table view, defaults to "Table" if not filled.
|
||||
zh_Hans: 默认表格视图的名称,不填则默认为"表格"。
|
||||
llm_description: 默认表格视图的名称,不填则默认为"表格"。
|
||||
form: llm
|
||||
|
||||
- name: fields
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Initial Fields
|
||||
zh_Hans: 初始字段
|
||||
human_description:
|
||||
en_US: |
|
||||
Initial fields of the data table, format: [ { "field_name": "Multi-line Text","type": 1 },{ "field_name": "Number","type": 2 },{ "field_name": "Single Select","type": 3 },{ "field_name": "Multiple Select","type": 4 },{ "field_name": "Date","type": 5 } ]. For field details, refer to: https://open.larkoffice.com/document/server-docs/docs/bitable-v1/app-table-field/guide
|
||||
zh_Hans: 数据表的初始字段,格式为:[{"field_name":"多行文本","type":1},{"field_name":"数字","type":2},{"field_name":"单选","type":3},{"field_name":"多选","type":4},{"field_name":"日期","type":5}]。字段详情参考:https://open.larkoffice.com/document/server-docs/docs/bitable-v1/app-table-field/guide
|
||||
llm_description: 数据表的初始字段,格式为:[{"field_name":"多行文本","type":1},{"field_name":"数字","type":2},{"field_name":"单选","type":3},{"field_name":"多选","type":4},{"field_name":"日期","type":5}]。字段详情参考:https://open.larkoffice.com/document/server-docs/docs/bitable-v1/app-table-field/guide
|
||||
form: llm
|
|
@ -0,0 +1,20 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class DeleteRecordsTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
app_token = tool_parameters.get("app_token")
|
||||
table_id = tool_parameters.get("table_id")
|
||||
table_name = tool_parameters.get("table_name")
|
||||
record_ids = tool_parameters.get("record_ids")
|
||||
|
||||
res = client.delete_records(app_token, table_id, table_name, record_ids)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,86 @@
|
|||
identity:
|
||||
name: delete_records
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Delete Records
|
||||
zh_Hans: 删除多条记录
|
||||
description:
|
||||
human:
|
||||
en_US: Delete Multiple Records from Multidimensional Table
|
||||
zh_Hans: 删除多维表格数据表中的多条记录
|
||||
llm: A tool for deleting multiple records from a multidimensional table. (删除多维表格数据表中的多条记录)
|
||||
parameters:
|
||||
- name: app_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: app_token
|
||||
zh_Hans: app_token
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table, supports inputting document URL.
|
||||
zh_Hans: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
llm_description: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
form: llm
|
||||
|
||||
- name: table_id
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: table_id
|
||||
zh_Hans: table_id
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table data, either table_id or table_name must be provided, cannot be empty simultaneously.
|
||||
zh_Hans: 多维表格数据表的唯一标识符,table_id 和 table_name 至少需要提供一个,不能同时为空。
|
||||
llm_description: 多维表格数据表的唯一标识符,table_id 和 table_name 至少需要提供一个,不能同时为空。
|
||||
form: llm
|
||||
|
||||
- name: table_name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: table_name
|
||||
zh_Hans: table_name
|
||||
human_description:
|
||||
en_US: Name of the multidimensional table data, either table_name or table_id must be provided, cannot be empty simultaneously.
|
||||
zh_Hans: 多维表格数据表的名称,table_name 和 table_id 至少需要提供一个,不能同时为空。
|
||||
llm_description: 多维表格数据表的名称,table_name 和 table_id 至少需要提供一个,不能同时为空。
|
||||
form: llm
|
||||
|
||||
- name: record_ids
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Record IDs
|
||||
zh_Hans: 记录 ID 列表
|
||||
human_description:
|
||||
en_US: |
|
||||
List of IDs for the records to be deleted, example value: ["recwNXzPQv"].
|
||||
zh_Hans: 删除的多条记录 ID 列表,示例值:["recwNXzPQv"]。
|
||||
llm_description: 删除的多条记录 ID 列表,示例值:["recwNXzPQv"]。
|
||||
form: llm
|
||||
|
||||
- name: user_id_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: open_id
|
||||
label:
|
||||
en_US: open_id
|
||||
zh_Hans: open_id
|
||||
- value: union_id
|
||||
label:
|
||||
en_US: union_id
|
||||
zh_Hans: union_id
|
||||
- value: user_id
|
||||
label:
|
||||
en_US: user_id
|
||||
zh_Hans: user_id
|
||||
default: "open_id"
|
||||
label:
|
||||
en_US: user_id_type
|
||||
zh_Hans: 用户 ID 类型
|
||||
human_description:
|
||||
en_US: User ID type, optional values are open_id, union_id, user_id, with a default value of open_id.
|
||||
zh_Hans: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
llm_description: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
form: form
|
|
@ -0,0 +1,19 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class DeleteTablesTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
app_token = tool_parameters.get("app_token")
|
||||
table_ids = tool_parameters.get("table_ids")
|
||||
table_names = tool_parameters.get("table_names")
|
||||
|
||||
res = client.delete_tables(app_token, table_ids, table_names)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,49 @@
|
|||
identity:
|
||||
name: delete_tables
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Delete Tables
|
||||
zh_Hans: 删除数据表
|
||||
description:
|
||||
human:
|
||||
en_US: Batch Delete Data Tables from Multidimensional Table
|
||||
zh_Hans: 批量删除多维表格中的数据表
|
||||
llm: A tool for batch deleting data tables from a multidimensional table. (批量删除多维表格中的数据表)
|
||||
parameters:
|
||||
- name: app_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: app_token
|
||||
zh_Hans: app_token
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table, supports inputting document URL.
|
||||
zh_Hans: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
llm_description: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
form: llm
|
||||
|
||||
- name: table_ids
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Table IDs
|
||||
zh_Hans: 数据表 ID
|
||||
human_description:
|
||||
en_US: |
|
||||
IDs of the tables to be deleted. Each operation supports deleting up to 50 tables. Example: ["tbl1TkhyTWDkSoZ3"]. Ensure that either table_ids or table_names is not empty.
|
||||
zh_Hans: 待删除的数据表的 ID,每次操作最多支持删除 50 个数据表。示例值:["tbl1TkhyTWDkSoZ3"]。请确保 table_ids 和 table_names 至少有一个不为空。
|
||||
llm_description: 待删除的数据表的 ID,每次操作最多支持删除 50 个数据表。示例值:["tbl1TkhyTWDkSoZ3"]。请确保 table_ids 和 table_names 至少有一个不为空。
|
||||
form: llm
|
||||
|
||||
- name: table_names
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Table Names
|
||||
zh_Hans: 数据表名称
|
||||
human_description:
|
||||
en_US: |
|
||||
Names of the tables to be deleted. Each operation supports deleting up to 50 tables. Example: ["Table1", "Table2"]. Ensure that either table_names or table_ids is not empty.
|
||||
zh_Hans: 待删除的数据表的名称,每次操作最多支持删除 50 个数据表。示例值:["数据表1", "数据表2"]。请确保 table_names 和 table_ids 至少有一个不为空。
|
||||
llm_description: 待删除的数据表的名称,每次操作最多支持删除 50 个数据表。示例值:["数据表1", "数据表2"]。请确保 table_names 和 table_ids 至少有一个不为空。
|
||||
form: llm
|
|
@ -0,0 +1,17 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class GetBaseInfoTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
app_token = tool_parameters.get("app_token")
|
||||
|
||||
res = client.get_base_info(app_token)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,23 @@
|
|||
identity:
|
||||
name: get_base_info
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Get Base Info
|
||||
zh_Hans: 获取多维表格元数据
|
||||
description:
|
||||
human:
|
||||
en_US: Get Metadata Information of Specified Multidimensional Table
|
||||
zh_Hans: 获取指定多维表格的元数据信息
|
||||
llm: A tool for getting metadata information of a specified multidimensional table. (获取指定多维表格的元数据信息)
|
||||
parameters:
|
||||
- name: app_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: app_token
|
||||
zh_Hans: app_token
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table, supports inputting document URL.
|
||||
zh_Hans: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
llm_description: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
form: llm
|
|
@ -0,0 +1,19 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class ListTablesTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
app_token = tool_parameters.get("app_token")
|
||||
page_token = tool_parameters.get("page_token")
|
||||
page_size = tool_parameters.get("page_size", 20)
|
||||
|
||||
res = client.list_tables(app_token, page_token, page_size)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,50 @@
|
|||
identity:
|
||||
name: list_tables
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: List Tables
|
||||
zh_Hans: 列出数据表
|
||||
description:
|
||||
human:
|
||||
en_US: Get All Data Tables under Multidimensional Table
|
||||
zh_Hans: 获取多维表格下的所有数据表
|
||||
llm: A tool for getting all data tables under a multidimensional table. (获取多维表格下的所有数据表)
|
||||
parameters:
|
||||
- name: app_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: app_token
|
||||
zh_Hans: app_token
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table, supports inputting document URL.
|
||||
zh_Hans: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
llm_description: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
form: llm
|
||||
|
||||
- name: page_size
|
||||
type: number
|
||||
required: false
|
||||
default: 20
|
||||
label:
|
||||
en_US: page_size
|
||||
zh_Hans: 分页大小
|
||||
human_description:
|
||||
en_US: |
|
||||
Page size, default value: 20, maximum value: 100.
|
||||
zh_Hans: 分页大小,默认值:20,最大值:100。
|
||||
llm_description: 分页大小,默认值:20,最大值:100。
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: page_token
|
||||
zh_Hans: 分页标记
|
||||
human_description:
|
||||
en_US: |
|
||||
Page token, leave empty for the first request to start from the beginning; a new page_token will be returned if there are more items in the paginated query results, which can be used for the next traversal. Example value: "tblsRc9GRRXKqhvW".
|
||||
zh_Hans: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果。示例值:"tblsRc9GRRXKqhvW"。
|
||||
llm_description: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果。示例值:"tblsRc9GRRXKqhvW"。
|
||||
form: llm
|
|
@ -0,0 +1,21 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class ReadRecordsTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
app_token = tool_parameters.get("app_token")
|
||||
table_id = tool_parameters.get("table_id")
|
||||
table_name = tool_parameters.get("table_name")
|
||||
record_ids = tool_parameters.get("record_ids")
|
||||
user_id_type = tool_parameters.get("user_id_type", "open_id")
|
||||
|
||||
res = client.read_records(app_token, table_id, table_name, record_ids, user_id_type)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,86 @@
|
|||
identity:
|
||||
name: read_records
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Read Records
|
||||
zh_Hans: 批量获取记录
|
||||
description:
|
||||
human:
|
||||
en_US: Batch Retrieve Records from Multidimensional Table
|
||||
zh_Hans: 批量获取多维表格数据表中的记录信息
|
||||
llm: A tool for batch retrieving records from a multidimensional table, supporting up to 100 records per call. (批量获取多维表格数据表中的记录信息,单次调用最多支持查询 100 条记录)
|
||||
|
||||
parameters:
|
||||
- name: app_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: app_token
|
||||
zh_Hans: app_token
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table, supports inputting document URL.
|
||||
zh_Hans: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
llm_description: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
form: llm
|
||||
|
||||
- name: table_id
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: table_id
|
||||
zh_Hans: table_id
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table data, either table_id or table_name must be provided, cannot be empty simultaneously.
|
||||
zh_Hans: 多维表格数据表的唯一标识符,table_id 和 table_name 至少需要提供一个,不能同时为空。
|
||||
llm_description: 多维表格数据表的唯一标识符,table_id 和 table_name 至少需要提供一个,不能同时为空。
|
||||
form: llm
|
||||
|
||||
- name: table_name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: table_name
|
||||
zh_Hans: table_name
|
||||
human_description:
|
||||
en_US: Name of the multidimensional table data, either table_name or table_id must be provided, cannot be empty simultaneously.
|
||||
zh_Hans: 多维表格数据表的名称,table_name 和 table_id 至少需要提供一个,不能同时为空。
|
||||
llm_description: 多维表格数据表的名称,table_name 和 table_id 至少需要提供一个,不能同时为空。
|
||||
form: llm
|
||||
|
||||
- name: record_ids
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: record_ids
|
||||
zh_Hans: 记录 ID 列表
|
||||
human_description:
|
||||
en_US: List of record IDs, which can be obtained by calling the "Query Records API".
|
||||
zh_Hans: 记录 ID 列表,可以通过调用"查询记录接口"获取。
|
||||
llm_description: 记录 ID 列表,可以通过调用"查询记录接口"获取。
|
||||
form: llm
|
||||
|
||||
- name: user_id_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: open_id
|
||||
label:
|
||||
en_US: open_id
|
||||
zh_Hans: open_id
|
||||
- value: union_id
|
||||
label:
|
||||
en_US: union_id
|
||||
zh_Hans: union_id
|
||||
- value: user_id
|
||||
label:
|
||||
en_US: user_id
|
||||
zh_Hans: user_id
|
||||
default: "open_id"
|
||||
label:
|
||||
en_US: user_id_type
|
||||
zh_Hans: 用户 ID 类型
|
||||
human_description:
|
||||
en_US: User ID type, optional values are open_id, union_id, user_id, with a default value of open_id.
|
||||
zh_Hans: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
llm_description: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
form: form
|
|
@ -0,0 +1,39 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class SearchRecordsTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
app_token = tool_parameters.get("app_token")
|
||||
table_id = tool_parameters.get("table_id")
|
||||
table_name = tool_parameters.get("table_name")
|
||||
view_id = tool_parameters.get("view_id")
|
||||
field_names = tool_parameters.get("field_names")
|
||||
sort = tool_parameters.get("sort")
|
||||
filters = tool_parameters.get("filter")
|
||||
page_token = tool_parameters.get("page_token")
|
||||
automatic_fields = tool_parameters.get("automatic_fields", False)
|
||||
user_id_type = tool_parameters.get("user_id_type", "open_id")
|
||||
page_size = tool_parameters.get("page_size", 20)
|
||||
|
||||
res = client.search_record(
|
||||
app_token,
|
||||
table_id,
|
||||
table_name,
|
||||
view_id,
|
||||
field_names,
|
||||
sort,
|
||||
filters,
|
||||
page_token,
|
||||
automatic_fields,
|
||||
user_id_type,
|
||||
page_size,
|
||||
)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,163 @@
|
|||
identity:
|
||||
name: search_records
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Search Records
|
||||
zh_Hans: 查询记录
|
||||
description:
|
||||
human:
|
||||
en_US: Query records in a multidimensional table, up to 500 rows per query.
|
||||
zh_Hans: 查询多维表格数据表中的记录,单次最多查询 500 行记录。
|
||||
llm: A tool for querying records in a multidimensional table, up to 500 rows per query. (查询多维表格数据表中的记录,单次最多查询 500 行记录)
|
||||
parameters:
|
||||
- name: app_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: app_token
|
||||
zh_Hans: app_token
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table, supports inputting document URL.
|
||||
zh_Hans: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
llm_description: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
form: llm
|
||||
|
||||
- name: table_id
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: table_id
|
||||
zh_Hans: table_id
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table data, either table_id or table_name must be provided, cannot be empty simultaneously.
|
||||
zh_Hans: 多维表格数据表的唯一标识符,table_id 和 table_name 至少需要提供一个,不能同时为空。
|
||||
llm_description: 多维表格数据表的唯一标识符,table_id 和 table_name 至少需要提供一个,不能同时为空。
|
||||
form: llm
|
||||
|
||||
- name: table_name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: table_name
|
||||
zh_Hans: table_name
|
||||
human_description:
|
||||
en_US: Name of the multidimensional table data, either table_name or table_id must be provided, cannot be empty simultaneously.
|
||||
zh_Hans: 多维表格数据表的名称,table_name 和 table_id 至少需要提供一个,不能同时为空。
|
||||
llm_description: 多维表格数据表的名称,table_name 和 table_id 至少需要提供一个,不能同时为空。
|
||||
form: llm
|
||||
|
||||
- name: view_id
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: view_id
|
||||
zh_Hans: 视图唯一标识
|
||||
human_description:
|
||||
en_US: |
|
||||
Unique identifier for a view in a multidimensional table. It can be found in the URL's query parameter with the key 'view'. For example: https://lark-japan.jp.larksuite.com/base/XXX0bfYEraW5OWsbhcFjEqj6pxh?table=tbl5I6jqwz8wBRMv&view=vewW5zXVEU.
|
||||
zh_Hans: 多维表格中视图的唯一标识,可在多维表格的 URL 地址栏中找到,query 参数中 key 为 view 的部分。例如:https://lark-japan.jp.larksuite.com/base/XXX0bfYEraW5OWsbhcFjEqj6pxh?table=tbl5I6jqwz8wBRMv&view=vewW5zXVEU。
|
||||
llm_description: 多维表格中视图的唯一标识,可在多维表格的 URL 地址栏中找到,query 参数中 key 为 view 的部分。例如:https://lark-japan.jp.larksuite.com/base/XXX0bfYEraW5OWsbhcFjEqj6pxh?table=tbl5I6jqwz8wBRMv&view=vewW5zXVEU。
|
||||
form: llm
|
||||
|
||||
- name: field_names
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: field_names
|
||||
zh_Hans: 字段名称
|
||||
human_description:
|
||||
en_US: |
|
||||
Field names to specify which fields to include in the returned records. Example value: ["Field1", "Field2"].
|
||||
zh_Hans: 字段名称,用于指定本次查询返回记录中包含的字段。示例值:["字段1","字段2"]。
|
||||
llm_description: 字段名称,用于指定本次查询返回记录中包含的字段。示例值:["字段1","字段2"]。
|
||||
form: llm
|
||||
|
||||
- name: sort
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: sort
|
||||
zh_Hans: 排序条件
|
||||
human_description:
|
||||
en_US: |
|
||||
Sorting conditions, for example: [{"field_name":"Multiline Text","desc":true}].
|
||||
zh_Hans: 排序条件,例如:[{"field_name":"多行文本","desc":true}]。
|
||||
llm_description: 排序条件,例如:[{"field_name":"多行文本","desc":true}]。
|
||||
form: llm
|
||||
|
||||
- name: filter
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: filter
|
||||
zh_Hans: 筛选条件
|
||||
human_description:
|
||||
en_US: Object containing filter information. For details on how to fill in the filter, refer to the record filter parameter guide (https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/record-filter-guide).
|
||||
zh_Hans: 包含条件筛选信息的对象。了解如何填写 filter,参考记录筛选参数填写指南(https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/record-filter-guide)。
|
||||
llm_description: 包含条件筛选信息的对象。了解如何填写 filter,参考记录筛选参数填写指南(https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/record-filter-guide)。
|
||||
form: llm
|
||||
|
||||
- name: automatic_fields
|
||||
type: boolean
|
||||
required: false
|
||||
label:
|
||||
en_US: automatic_fields
|
||||
zh_Hans: automatic_fields
|
||||
human_description:
|
||||
en_US: Whether to return automatically calculated fields. Default is false, meaning they are not returned.
|
||||
zh_Hans: 是否返回自动计算的字段。默认为 false,表示不返回。
|
||||
llm_description: 是否返回自动计算的字段。默认为 false,表示不返回。
|
||||
form: form
|
||||
|
||||
- name: user_id_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: open_id
|
||||
label:
|
||||
en_US: open_id
|
||||
zh_Hans: open_id
|
||||
- value: union_id
|
||||
label:
|
||||
en_US: union_id
|
||||
zh_Hans: union_id
|
||||
- value: user_id
|
||||
label:
|
||||
en_US: user_id
|
||||
zh_Hans: user_id
|
||||
default: "open_id"
|
||||
label:
|
||||
en_US: user_id_type
|
||||
zh_Hans: 用户 ID 类型
|
||||
human_description:
|
||||
en_US: User ID type, optional values are open_id, union_id, user_id, with a default value of open_id.
|
||||
zh_Hans: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
llm_description: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
form: form
|
||||
|
||||
- name: page_size
|
||||
type: number
|
||||
required: false
|
||||
default: 20
|
||||
label:
|
||||
en_US: page_size
|
||||
zh_Hans: 分页大小
|
||||
human_description:
|
||||
en_US: |
|
||||
Page size, default value: 20, maximum value: 500.
|
||||
zh_Hans: 分页大小,默认值:20,最大值:500。
|
||||
llm_description: 分页大小,默认值:20,最大值:500。
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: page_token
|
||||
zh_Hans: 分页标记
|
||||
human_description:
|
||||
en_US: |
|
||||
Page token, leave empty for the first request to start from the beginning; a new page_token will be returned if there are more items in the paginated query results, which can be used for the next traversal. Example value: "tblsRc9GRRXKqhvW".
|
||||
zh_Hans: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果。示例值:"tblsRc9GRRXKqhvW"。
|
||||
llm_description: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果。示例值:"tblsRc9GRRXKqhvW"。
|
||||
form: llm
|
|
@ -0,0 +1,21 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class UpdateRecordsTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
app_token = tool_parameters.get("app_token")
|
||||
table_id = tool_parameters.get("table_id")
|
||||
table_name = tool_parameters.get("table_name")
|
||||
records = tool_parameters.get("records")
|
||||
user_id_type = tool_parameters.get("user_id_type", "open_id")
|
||||
|
||||
res = client.update_records(app_token, table_id, table_name, records, user_id_type)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,91 @@
|
|||
identity:
|
||||
name: update_records
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Update Records
|
||||
zh_Hans: 更新多条记录
|
||||
description:
|
||||
human:
|
||||
en_US: Update Multiple Records in Multidimensional Table
|
||||
zh_Hans: 更新多维表格数据表中的多条记录
|
||||
llm: A tool for updating multiple records in a multidimensional table. (更新多维表格数据表中的多条记录)
|
||||
parameters:
|
||||
- name: app_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: app_token
|
||||
zh_Hans: app_token
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table, supports inputting document URL.
|
||||
zh_Hans: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
llm_description: 多维表格的唯一标识符,支持输入文档 URL。
|
||||
form: llm
|
||||
|
||||
- name: table_id
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: table_id
|
||||
zh_Hans: table_id
|
||||
human_description:
|
||||
en_US: Unique identifier for the multidimensional table data, either table_id or table_name must be provided, cannot be empty simultaneously.
|
||||
zh_Hans: 多维表格数据表的唯一标识符,table_id 和 table_name 至少需要提供一个,不能同时为空。
|
||||
llm_description: 多维表格数据表的唯一标识符,table_id 和 table_name 至少需要提供一个,不能同时为空。
|
||||
form: llm
|
||||
|
||||
- name: table_name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: table_name
|
||||
zh_Hans: table_name
|
||||
human_description:
|
||||
en_US: Name of the multidimensional table data, either table_name or table_id must be provided, cannot be empty simultaneously.
|
||||
zh_Hans: 多维表格数据表的名称,table_name 和 table_id 至少需要提供一个,不能同时为空。
|
||||
llm_description: 多维表格数据表的名称,table_name 和 table_id 至少需要提供一个,不能同时为空。
|
||||
form: llm
|
||||
|
||||
- name: records
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: records
|
||||
zh_Hans: 记录列表
|
||||
human_description:
|
||||
en_US: |
|
||||
List of records to be updated in this request. Example value: [{"fields":{"multi-line-text":"text content","single_select":"option 1","date":1674206443000},"record_id":"recupK4f4RM5RX"}].
|
||||
For supported field types, refer to the integration guide (https://open.larkoffice.com/document/server-docs/docs/bitable-v1/notification). For data structures of different field types, refer to the data structure overview (https://open.larkoffice.com/document/server-docs/docs/bitable-v1/bitable-structure).
|
||||
zh_Hans: |
|
||||
本次请求将要更新的记录列表,示例值:[{"fields":{"多行文本":"文本内容","单选":"选项 1","日期":1674206443000},"record_id":"recupK4f4RM5RX"}]。
|
||||
当前接口支持的字段类型请参考接入指南(https://open.larkoffice.com/document/server-docs/docs/bitable-v1/notification),不同类型字段的数据结构请参考数据结构概述(https://open.larkoffice.com/document/server-docs/docs/bitable-v1/bitable-structure)。
|
||||
llm_description: |
|
||||
本次请求将要更新的记录列表,示例值:[{"fields":{"多行文本":"文本内容","单选":"选项 1","日期":1674206443000},"record_id":"recupK4f4RM5RX"}]。
|
||||
当前接口支持的字段类型请参考接入指南(https://open.larkoffice.com/document/server-docs/docs/bitable-v1/notification),不同类型字段的数据结构请参考数据结构概述(https://open.larkoffice.com/document/server-docs/docs/bitable-v1/bitable-structure)。
|
||||
form: llm
|
||||
|
||||
- name: user_id_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: open_id
|
||||
label:
|
||||
en_US: open_id
|
||||
zh_Hans: open_id
|
||||
- value: union_id
|
||||
label:
|
||||
en_US: union_id
|
||||
zh_Hans: union_id
|
||||
- value: user_id
|
||||
label:
|
||||
en_US: user_id
|
||||
zh_Hans: user_id
|
||||
default: "open_id"
|
||||
label:
|
||||
en_US: user_id_type
|
||||
zh_Hans: 用户 ID 类型
|
||||
human_description:
|
||||
en_US: User ID type, optional values are open_id, union_id, user_id, with a default value of open_id.
|
||||
zh_Hans: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
llm_description: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
form: form
|
BIN
api/core/tools/provider/builtin/lark_calendar/_assets/icon.png
Normal file
BIN
api/core/tools/provider/builtin/lark_calendar/_assets/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
|
@ -0,0 +1,7 @@
|
|||
from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController
|
||||
from core.tools.utils.lark_api_utils import lark_auth
|
||||
|
||||
|
||||
class LarkCalendarProvider(BuiltinToolProviderController):
|
||||
def _validate_credentials(self, credentials: dict) -> None:
|
||||
lark_auth(credentials)
|
|
@ -0,0 +1,36 @@
|
|||
identity:
|
||||
author: Doug Lea
|
||||
name: lark_calendar
|
||||
label:
|
||||
en_US: Lark Calendar
|
||||
zh_Hans: Lark 日历
|
||||
description:
|
||||
en_US: |
|
||||
Lark calendar, requires the following permissions: calendar:calendar:read、calendar:calendar、contact:user.id:readonly.
|
||||
zh_Hans: |
|
||||
Lark 日历,需要开通以下权限: calendar:calendar:read、calendar:calendar、contact:user.id:readonly。
|
||||
icon: icon.png
|
||||
tags:
|
||||
- social
|
||||
- productivity
|
||||
credentials_for_provider:
|
||||
app_id:
|
||||
type: text-input
|
||||
required: true
|
||||
label:
|
||||
en_US: APP ID
|
||||
placeholder:
|
||||
en_US: Please input your Lark app id
|
||||
zh_Hans: 请输入你的 Lark app id
|
||||
help:
|
||||
en_US: Get your app_id and app_secret from Lark
|
||||
zh_Hans: 从 Lark 获取您的 app_id 和 app_secret
|
||||
url: https://open.larksuite.com/app
|
||||
app_secret:
|
||||
type: secret-input
|
||||
required: true
|
||||
label:
|
||||
en_US: APP Secret
|
||||
placeholder:
|
||||
en_US: Please input your app secret
|
||||
zh_Hans: 请输入你的 Lark app secret
|
|
@ -0,0 +1,20 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class AddEventAttendeesTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
event_id = tool_parameters.get("event_id")
|
||||
attendee_phone_or_email = tool_parameters.get("attendee_phone_or_email")
|
||||
need_notification = tool_parameters.get("need_notification", True)
|
||||
|
||||
res = client.add_event_attendees(event_id, attendee_phone_or_email, need_notification)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,54 @@
|
|||
identity:
|
||||
name: add_event_attendees
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Add Event Attendees
|
||||
zh_Hans: 添加日程参会人
|
||||
description:
|
||||
human:
|
||||
en_US: Add Event Attendees
|
||||
zh_Hans: 添加日程参会人
|
||||
llm: A tool for adding attendees to events in Lark. (在 Lark 中添加日程参会人)
|
||||
parameters:
|
||||
- name: event_id
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Event ID
|
||||
zh_Hans: 日程 ID
|
||||
human_description:
|
||||
en_US: |
|
||||
The ID of the event, which will be returned when the event is created. For example: fb2a6406-26d6-4c8d-a487-6f0246c94d2f_0.
|
||||
zh_Hans: |
|
||||
创建日程时会返回日程 ID。例如: fb2a6406-26d6-4c8d-a487-6f0246c94d2f_0。
|
||||
llm_description: |
|
||||
日程 ID,创建日程时会返回日程 ID。例如: fb2a6406-26d6-4c8d-a487-6f0246c94d2f_0。
|
||||
form: llm
|
||||
|
||||
- name: need_notification
|
||||
type: boolean
|
||||
required: false
|
||||
default: true
|
||||
label:
|
||||
en_US: Need Notification
|
||||
zh_Hans: 是否需要通知
|
||||
human_description:
|
||||
en_US: |
|
||||
Whether to send a Bot notification to attendees. true: send, false: do not send.
|
||||
zh_Hans: |
|
||||
是否给参与人发送 Bot 通知,true: 发送,false: 不发送。
|
||||
llm_description: |
|
||||
是否给参与人发送 Bot 通知,true: 发送,false: 不发送。
|
||||
form: form
|
||||
|
||||
- name: attendee_phone_or_email
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Attendee Phone or Email
|
||||
zh_Hans: 参会人电话或邮箱
|
||||
human_description:
|
||||
en_US: The list of attendee emails or phone numbers, separated by commas.
|
||||
zh_Hans: 日程参会人邮箱或者手机号列表,使用逗号分隔。
|
||||
llm_description: 日程参会人邮箱或者手机号列表,使用逗号分隔。
|
||||
form: llm
|
|
@ -0,0 +1,26 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class CreateEventTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
summary = tool_parameters.get("summary")
|
||||
description = tool_parameters.get("description")
|
||||
start_time = tool_parameters.get("start_time")
|
||||
end_time = tool_parameters.get("end_time")
|
||||
attendee_ability = tool_parameters.get("attendee_ability")
|
||||
need_notification = tool_parameters.get("need_notification", True)
|
||||
auto_record = tool_parameters.get("auto_record", False)
|
||||
|
||||
res = client.create_event(
|
||||
summary, description, start_time, end_time, attendee_ability, need_notification, auto_record
|
||||
)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,119 @@
|
|||
identity:
|
||||
name: create_event
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Create Event
|
||||
zh_Hans: 创建日程
|
||||
description:
|
||||
human:
|
||||
en_US: Create Event
|
||||
zh_Hans: 创建日程
|
||||
llm: A tool for creating events in Lark.(创建 Lark 日程)
|
||||
parameters:
|
||||
- name: summary
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Summary
|
||||
zh_Hans: 日程标题
|
||||
human_description:
|
||||
en_US: The title of the event. If not filled, the event title will display (No Subject).
|
||||
zh_Hans: 日程标题,若不填则日程标题显示 (无主题)。
|
||||
llm_description: 日程标题,若不填则日程标题显示 (无主题)。
|
||||
form: llm
|
||||
|
||||
- name: description
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Description
|
||||
zh_Hans: 日程描述
|
||||
human_description:
|
||||
en_US: The description of the event.
|
||||
zh_Hans: 日程描述。
|
||||
llm_description: 日程描述。
|
||||
form: llm
|
||||
|
||||
- name: need_notification
|
||||
type: boolean
|
||||
required: false
|
||||
default: true
|
||||
label:
|
||||
en_US: Need Notification
|
||||
zh_Hans: 是否发送通知
|
||||
human_description:
|
||||
en_US: |
|
||||
Whether to send a bot message when the event is created, true: send, false: do not send.
|
||||
zh_Hans: 创建日程时是否发送 bot 消息,true:发送,false:不发送。
|
||||
llm_description: 创建日程时是否发送 bot 消息,true:发送,false:不发送。
|
||||
form: form
|
||||
|
||||
- name: start_time
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Start Time
|
||||
zh_Hans: 开始时间
|
||||
human_description:
|
||||
en_US: |
|
||||
The start time of the event, format: 2006-01-02 15:04:05.
|
||||
zh_Hans: 日程开始时间,格式:2006-01-02 15:04:05。
|
||||
llm_description: 日程开始时间,格式:2006-01-02 15:04:05。
|
||||
form: llm
|
||||
|
||||
- name: end_time
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: End Time
|
||||
zh_Hans: 结束时间
|
||||
human_description:
|
||||
en_US: |
|
||||
The end time of the event, format: 2006-01-02 15:04:05.
|
||||
zh_Hans: 日程结束时间,格式:2006-01-02 15:04:05。
|
||||
llm_description: 日程结束时间,格式:2006-01-02 15:04:05。
|
||||
form: llm
|
||||
|
||||
- name: attendee_ability
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: none
|
||||
label:
|
||||
en_US: none
|
||||
zh_Hans: 无
|
||||
- value: can_see_others
|
||||
label:
|
||||
en_US: can_see_others
|
||||
zh_Hans: 可以查看参与人列表
|
||||
- value: can_invite_others
|
||||
label:
|
||||
en_US: can_invite_others
|
||||
zh_Hans: 可以邀请其它参与人
|
||||
- value: can_modify_event
|
||||
label:
|
||||
en_US: can_modify_event
|
||||
zh_Hans: 可以编辑日程
|
||||
default: "none"
|
||||
label:
|
||||
en_US: attendee_ability
|
||||
zh_Hans: 参会人权限
|
||||
human_description:
|
||||
en_US: Attendee ability, optional values are none, can_see_others, can_invite_others, can_modify_event, with a default value of none.
|
||||
zh_Hans: 参会人权限,可选值有无、可以查看参与人列表、可以邀请其它参与人、可以编辑日程,默认值为无。
|
||||
llm_description: 参会人权限,可选值有无、可以查看参与人列表、可以邀请其它参与人、可以编辑日程,默认值为无。
|
||||
form: form
|
||||
|
||||
- name: auto_record
|
||||
type: boolean
|
||||
required: false
|
||||
default: false
|
||||
label:
|
||||
en_US: Auto Record
|
||||
zh_Hans: 自动录制
|
||||
human_description:
|
||||
en_US: |
|
||||
Whether to enable automatic recording, true: enabled, automatically record when the meeting starts; false: not enabled.
|
||||
zh_Hans: 是否开启自动录制,true:开启,会议开始后自动录制;false:不开启。
|
||||
llm_description: 是否开启自动录制,true:开启,会议开始后自动录制;false:不开启。
|
||||
form: form
|
|
@ -0,0 +1,19 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class DeleteEventTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
event_id = tool_parameters.get("event_id")
|
||||
need_notification = tool_parameters.get("need_notification", True)
|
||||
|
||||
res = client.delete_event(event_id, need_notification)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,38 @@
|
|||
identity:
|
||||
name: delete_event
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Delete Event
|
||||
zh_Hans: 删除日程
|
||||
description:
|
||||
human:
|
||||
en_US: Delete Event
|
||||
zh_Hans: 删除日程
|
||||
llm: A tool for deleting events in Lark.(在 Lark 中删除日程)
|
||||
parameters:
|
||||
- name: event_id
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Event ID
|
||||
zh_Hans: 日程 ID
|
||||
human_description:
|
||||
en_US: |
|
||||
The ID of the event, for example: e8b9791c-39ae-4908-8ad8-66b13159b9fb_0.
|
||||
zh_Hans: 日程 ID,例如:e8b9791c-39ae-4908-8ad8-66b13159b9fb_0。
|
||||
llm_description: 日程 ID,例如:e8b9791c-39ae-4908-8ad8-66b13159b9fb_0。
|
||||
form: llm
|
||||
|
||||
- name: need_notification
|
||||
type: boolean
|
||||
required: false
|
||||
default: true
|
||||
label:
|
||||
en_US: Need Notification
|
||||
zh_Hans: 是否需要通知
|
||||
human_description:
|
||||
en_US: |
|
||||
Indicates whether to send bot notifications to event participants upon deletion. true: send, false: do not send.
|
||||
zh_Hans: 删除日程是否给日程参与人发送 bot 通知,true:发送,false:不发送。
|
||||
llm_description: 删除日程是否给日程参与人发送 bot 通知,true:发送,false:不发送。
|
||||
form: form
|
|
@ -0,0 +1,18 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class GetPrimaryCalendarTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
user_id_type = tool_parameters.get("user_id_type", "open_id")
|
||||
|
||||
res = client.get_primary_calendar(user_id_type)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,37 @@
|
|||
identity:
|
||||
name: get_primary_calendar
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Get Primary Calendar
|
||||
zh_Hans: 查询主日历信息
|
||||
description:
|
||||
human:
|
||||
en_US: Get Primary Calendar
|
||||
zh_Hans: 查询主日历信息
|
||||
llm: A tool for querying primary calendar information in Lark.(在 Lark 中查询主日历信息)
|
||||
parameters:
|
||||
- name: user_id_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: open_id
|
||||
label:
|
||||
en_US: open_id
|
||||
zh_Hans: open_id
|
||||
- value: union_id
|
||||
label:
|
||||
en_US: union_id
|
||||
zh_Hans: union_id
|
||||
- value: user_id
|
||||
label:
|
||||
en_US: user_id
|
||||
zh_Hans: user_id
|
||||
default: "open_id"
|
||||
label:
|
||||
en_US: user_id_type
|
||||
zh_Hans: 用户 ID 类型
|
||||
human_description:
|
||||
en_US: User ID type, optional values are open_id, union_id, user_id, with a default value of open_id.
|
||||
zh_Hans: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
llm_description: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
form: form
|
|
@ -0,0 +1,21 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class ListEventsTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
start_time = tool_parameters.get("start_time")
|
||||
end_time = tool_parameters.get("end_time")
|
||||
page_token = tool_parameters.get("page_token")
|
||||
page_size = tool_parameters.get("page_size")
|
||||
|
||||
res = client.list_events(start_time, end_time, page_token, page_size)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,62 @@
|
|||
identity:
|
||||
name: list_events
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: List Events
|
||||
zh_Hans: 获取日程列表
|
||||
description:
|
||||
human:
|
||||
en_US: List Events
|
||||
zh_Hans: 获取日程列表
|
||||
llm: A tool for listing events in Lark.(在 Lark 中获取日程列表)
|
||||
parameters:
|
||||
- name: start_time
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Start Time
|
||||
zh_Hans: 开始时间
|
||||
human_description:
|
||||
en_US: |
|
||||
The start time, defaults to 0:00 of the current day if not provided, format: 2006-01-02 15:04:05.
|
||||
zh_Hans: 开始时间,不传值时默认当天 0 点时间,格式为:2006-01-02 15:04:05。
|
||||
llm_description: 开始时间,不传值时默认当天 0 点时间,格式为:2006-01-02 15:04:05。
|
||||
form: llm
|
||||
|
||||
- name: end_time
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: End Time
|
||||
zh_Hans: 结束时间
|
||||
human_description:
|
||||
en_US: |
|
||||
The end time, defaults to 23:59 of the current day if not provided, format: 2006-01-02 15:04:05.
|
||||
zh_Hans: 结束时间,不传值时默认当天 23:59 分时间,格式为:2006-01-02 15:04:05。
|
||||
llm_description: 结束时间,不传值时默认当天 23:59 分时间,格式为:2006-01-02 15:04:05。
|
||||
form: llm
|
||||
|
||||
- name: page_size
|
||||
type: number
|
||||
required: false
|
||||
default: 50
|
||||
label:
|
||||
en_US: Page Size
|
||||
zh_Hans: 分页大小
|
||||
human_description:
|
||||
en_US: The page size, i.e., the number of data entries returned in a single request. The default value is 50, and the value range is [50,1000].
|
||||
zh_Hans: 分页大小,即单次请求所返回的数据条目数。默认值为 50,取值范围为 [50,1000]。
|
||||
llm_description: 分页大小,即单次请求所返回的数据条目数。默认值为 50,取值范围为 [50,1000]。
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Page Token
|
||||
zh_Hans: 分页标记
|
||||
human_description:
|
||||
en_US: The pagination token. Leave it blank for the first request, indicating to start traversing from the beginning; when the pagination query result has more items, a new page_token will be returned simultaneously, which can be used to obtain the query result in the next traversal.
|
||||
zh_Hans: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果。
|
||||
llm_description: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果。
|
||||
form: llm
|
|
@ -0,0 +1,23 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class SearchEventsTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
query = tool_parameters.get("query")
|
||||
start_time = tool_parameters.get("start_time")
|
||||
end_time = tool_parameters.get("end_time")
|
||||
page_token = tool_parameters.get("page_token")
|
||||
user_id_type = tool_parameters.get("user_id_type", "open_id")
|
||||
page_size = tool_parameters.get("page_size", 20)
|
||||
|
||||
res = client.search_events(query, start_time, end_time, page_token, user_id_type, page_size)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,100 @@
|
|||
identity:
|
||||
name: search_events
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Search Events
|
||||
zh_Hans: 搜索日程
|
||||
description:
|
||||
human:
|
||||
en_US: Search Events
|
||||
zh_Hans: 搜索日程
|
||||
llm: A tool for searching events in Lark.(在 Lark 中搜索日程)
|
||||
parameters:
|
||||
- name: user_id_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: open_id
|
||||
label:
|
||||
en_US: open_id
|
||||
zh_Hans: open_id
|
||||
- value: union_id
|
||||
label:
|
||||
en_US: union_id
|
||||
zh_Hans: union_id
|
||||
- value: user_id
|
||||
label:
|
||||
en_US: user_id
|
||||
zh_Hans: user_id
|
||||
default: "open_id"
|
||||
label:
|
||||
en_US: user_id_type
|
||||
zh_Hans: 用户 ID 类型
|
||||
human_description:
|
||||
en_US: User ID type, optional values are open_id, union_id, user_id, with a default value of open_id.
|
||||
zh_Hans: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
llm_description: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
form: form
|
||||
|
||||
- name: query
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Query
|
||||
zh_Hans: 搜索关键字
|
||||
human_description:
|
||||
en_US: The search keyword used for fuzzy searching event names, with a maximum input of 200 characters.
|
||||
zh_Hans: 用于模糊查询日程名称的搜索关键字,最大输入 200 字符。
|
||||
llm_description: 用于模糊查询日程名称的搜索关键字,最大输入 200 字符。
|
||||
form: llm
|
||||
|
||||
- name: start_time
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Start Time
|
||||
zh_Hans: 开始时间
|
||||
human_description:
|
||||
en_US: |
|
||||
The start time, defaults to 0:00 of the current day if not provided, format: 2006-01-02 15:04:05.
|
||||
zh_Hans: 开始时间,不传值时默认当天 0 点时间,格式为:2006-01-02 15:04:05。
|
||||
llm_description: 开始时间,不传值时默认当天 0 点时间,格式为:2006-01-02 15:04:05。
|
||||
form: llm
|
||||
|
||||
- name: end_time
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: End Time
|
||||
zh_Hans: 结束时间
|
||||
human_description:
|
||||
en_US: |
|
||||
The end time, defaults to 23:59 of the current day if not provided, format: 2006-01-02 15:04:05.
|
||||
zh_Hans: 结束时间,不传值时默认当天 23:59 分时间,格式为:2006-01-02 15:04:05。
|
||||
llm_description: 结束时间,不传值时默认当天 23:59 分时间,格式为:2006-01-02 15:04:05。
|
||||
form: llm
|
||||
|
||||
- name: page_size
|
||||
type: number
|
||||
required: false
|
||||
default: 20
|
||||
label:
|
||||
en_US: Page Size
|
||||
zh_Hans: 分页大小
|
||||
human_description:
|
||||
en_US: The page size, i.e., the number of data entries returned in a single request. The default value is 20, and the value range is [10,100].
|
||||
zh_Hans: 分页大小,即单次请求所返回的数据条目数。默认值为 20,取值范围为 [10,100]。
|
||||
llm_description: 分页大小,即单次请求所返回的数据条目数。默认值为 20,取值范围为 [10,100]。
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Page Token
|
||||
zh_Hans: 分页标记
|
||||
human_description:
|
||||
en_US: The pagination token. Leave it blank for the first request, indicating to start traversing from the beginning; when the pagination query result has more items, a new page_token will be returned simultaneously, which can be used to obtain the query result in the next traversal.
|
||||
zh_Hans: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果。
|
||||
llm_description: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果。
|
||||
form: llm
|
|
@ -0,0 +1,24 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class UpdateEventTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
event_id = tool_parameters.get("event_id")
|
||||
summary = tool_parameters.get("summary")
|
||||
description = tool_parameters.get("description")
|
||||
need_notification = tool_parameters.get("need_notification", True)
|
||||
start_time = tool_parameters.get("start_time")
|
||||
end_time = tool_parameters.get("end_time")
|
||||
auto_record = tool_parameters.get("auto_record", False)
|
||||
|
||||
res = client.update_event(event_id, summary, description, need_notification, start_time, end_time, auto_record)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,100 @@
|
|||
identity:
|
||||
name: update_event
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Update Event
|
||||
zh_Hans: 更新日程
|
||||
description:
|
||||
human:
|
||||
en_US: Update Event
|
||||
zh_Hans: 更新日程
|
||||
llm: A tool for updating events in Lark.(更新 Lark 中的日程)
|
||||
parameters:
|
||||
- name: event_id
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Event ID
|
||||
zh_Hans: 日程 ID
|
||||
human_description:
|
||||
en_US: |
|
||||
The ID of the event, for example: e8b9791c-39ae-4908-8ad8-66b13159b9fb_0.
|
||||
zh_Hans: 日程 ID,例如:e8b9791c-39ae-4908-8ad8-66b13159b9fb_0。
|
||||
llm_description: 日程 ID,例如:e8b9791c-39ae-4908-8ad8-66b13159b9fb_0。
|
||||
form: llm
|
||||
|
||||
- name: summary
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Summary
|
||||
zh_Hans: 日程标题
|
||||
human_description:
|
||||
en_US: The title of the event.
|
||||
zh_Hans: 日程标题。
|
||||
llm_description: 日程标题。
|
||||
form: llm
|
||||
|
||||
- name: description
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Description
|
||||
zh_Hans: 日程描述
|
||||
human_description:
|
||||
en_US: The description of the event.
|
||||
zh_Hans: 日程描述。
|
||||
llm_description: 日程描述。
|
||||
form: llm
|
||||
|
||||
- name: need_notification
|
||||
type: boolean
|
||||
required: false
|
||||
label:
|
||||
en_US: Need Notification
|
||||
zh_Hans: 是否发送通知
|
||||
human_description:
|
||||
en_US: |
|
||||
Whether to send a bot message when the event is updated, true: send, false: do not send.
|
||||
zh_Hans: 更新日程时是否发送 bot 消息,true:发送,false:不发送。
|
||||
llm_description: 更新日程时是否发送 bot 消息,true:发送,false:不发送。
|
||||
form: form
|
||||
|
||||
- name: start_time
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Start Time
|
||||
zh_Hans: 开始时间
|
||||
human_description:
|
||||
en_US: |
|
||||
The start time of the event, format: 2006-01-02 15:04:05.
|
||||
zh_Hans: 日程开始时间,格式:2006-01-02 15:04:05。
|
||||
llm_description: 日程开始时间,格式:2006-01-02 15:04:05。
|
||||
form: llm
|
||||
|
||||
- name: end_time
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: End Time
|
||||
zh_Hans: 结束时间
|
||||
human_description:
|
||||
en_US: |
|
||||
The end time of the event, format: 2006-01-02 15:04:05.
|
||||
zh_Hans: 日程结束时间,格式:2006-01-02 15:04:05。
|
||||
llm_description: 日程结束时间,格式:2006-01-02 15:04:05。
|
||||
form: llm
|
||||
|
||||
- name: auto_record
|
||||
type: boolean
|
||||
required: false
|
||||
label:
|
||||
en_US: Auto Record
|
||||
zh_Hans: 自动录制
|
||||
human_description:
|
||||
en_US: |
|
||||
Whether to enable automatic recording, true: enabled, automatically record when the meeting starts; false: not enabled.
|
||||
zh_Hans: 是否开启自动录制,true:开启,会议开始后自动录制;false:不开启。
|
||||
llm_description: 是否开启自动录制,true:开启,会议开始后自动录制;false:不开启。
|
||||
form: form
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="64px" height="64px" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g><path style="opacity:1" fill="#fefefe" d="M -0.5,-0.5 C 20.8333,-0.5 42.1667,-0.5 63.5,-0.5C 63.5,20.8333 63.5,42.1667 63.5,63.5C 42.1667,63.5 20.8333,63.5 -0.5,63.5C -0.5,42.1667 -0.5,20.8333 -0.5,-0.5 Z"/></g>
|
||||
<g><path style="opacity:1" fill="#346df3" d="M 47.5,33.5 C 43.3272,29.8779 38.9939,29.7112 34.5,33C 32.682,35.4897 30.3487,37.3231 27.5,38.5C 23.5003,43.5136 24.167,47.847 29.5,51.5C 24.1563,51.666 18.8229,51.4994 13.5,51C 13,50.5 12.5,50 12,49.5C 11.3333,36.8333 11.3333,24.1667 12,11.5C 12.5,11 13,10.5 13.5,10C 24.1667,9.33333 34.8333,9.33333 45.5,10C 46,10.5 46.5,11 47,11.5C 47.4997,18.8258 47.6663,26.1591 47.5,33.5 Z"/></g>
|
||||
<g><path style="opacity:1" fill="#f9fafe" d="M 20.5,19.5 C 25.1785,19.3342 29.8452,19.5008 34.5,20C 35.8333,21 35.8333,22 34.5,23C 29.8333,23.6667 25.1667,23.6667 20.5,23C 19.3157,21.8545 19.3157,20.6879 20.5,19.5 Z"/></g>
|
||||
<g><path style="opacity:1" fill="#f3f6fe" d="M 20.5,27.5 C 22.5273,27.3379 24.5273,27.5045 26.5,28C 27.8333,29 27.8333,30 26.5,31C 24.5,31.6667 22.5,31.6667 20.5,31C 19.3157,29.8545 19.3157,28.6879 20.5,27.5 Z"/></g>
|
||||
<g><path style="opacity:1" fill="#36d4c1" d="M 47.5,33.5 C 48.7298,35.2972 49.3964,37.2972 49.5,39.5C 51.3904,39.2965 52.8904,39.9632 54,41.5C 55.1825,45.2739 54.3492,48.4406 51.5,51C 44.1742,51.4997 36.8409,51.6663 29.5,51.5C 24.167,47.847 23.5003,43.5136 27.5,38.5C 30.3487,37.3231 32.682,35.4897 34.5,33C 38.9939,29.7112 43.3272,29.8779 47.5,33.5 Z"/></g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.8 KiB |
|
@ -0,0 +1,7 @@
|
|||
from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController
|
||||
from core.tools.utils.lark_api_utils import lark_auth
|
||||
|
||||
|
||||
class LarkDocumentProvider(BuiltinToolProviderController):
|
||||
def _validate_credentials(self, credentials: dict) -> None:
|
||||
lark_auth(credentials)
|
|
@ -0,0 +1,36 @@
|
|||
identity:
|
||||
author: Doug Lea
|
||||
name: lark_document
|
||||
label:
|
||||
en_US: Lark Cloud Document
|
||||
zh_Hans: Lark 云文档
|
||||
description:
|
||||
en_US: |
|
||||
Lark cloud document, requires the following permissions: docx:document、drive:drive、docs:document.content:read.
|
||||
zh_Hans: |
|
||||
Lark 云文档,需要开通以下权限: docx:document、drive:drive、docs:document.content:read。
|
||||
icon: icon.svg
|
||||
tags:
|
||||
- social
|
||||
- productivity
|
||||
credentials_for_provider:
|
||||
app_id:
|
||||
type: text-input
|
||||
required: true
|
||||
label:
|
||||
en_US: APP ID
|
||||
placeholder:
|
||||
en_US: Please input your Lark app id
|
||||
zh_Hans: 请输入你的 Lark app id
|
||||
help:
|
||||
en_US: Get your app_id and app_secret from Lark
|
||||
zh_Hans: 从 Lark 获取您的 app_id 和 app_secret
|
||||
url: https://open.larksuite.com/app
|
||||
app_secret:
|
||||
type: secret-input
|
||||
required: true
|
||||
label:
|
||||
en_US: APP Secret
|
||||
placeholder:
|
||||
en_US: Please input your app secret
|
||||
zh_Hans: 请输入你的 Lark app secret
|
|
@ -0,0 +1,19 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class CreateDocumentTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
title = tool_parameters.get("title")
|
||||
content = tool_parameters.get("content")
|
||||
folder_token = tool_parameters.get("folder_token")
|
||||
|
||||
res = client.create_document(title, content, folder_token)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,48 @@
|
|||
identity:
|
||||
name: create_document
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Create Lark document
|
||||
zh_Hans: 创建 Lark 文档
|
||||
description:
|
||||
human:
|
||||
en_US: Create Lark document
|
||||
zh_Hans: 创建 Lark 文档,支持创建空文档和带内容的文档,支持 markdown 语法创建。应用需要开启机器人能力(https://open.larksuite.com/document/faq/trouble-shooting/how-to-enable-bot-ability)。
|
||||
llm: A tool for creating Lark documents.
|
||||
parameters:
|
||||
- name: title
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Document title
|
||||
zh_Hans: 文档标题
|
||||
human_description:
|
||||
en_US: Document title, only supports plain text content.
|
||||
zh_Hans: 文档标题,只支持纯文本内容。
|
||||
llm_description: 文档标题,只支持纯文本内容,可以为空。
|
||||
form: llm
|
||||
|
||||
- name: content
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Document content
|
||||
zh_Hans: 文档内容
|
||||
human_description:
|
||||
en_US: Document content, supports markdown syntax, can be empty.
|
||||
zh_Hans: 文档内容,支持 markdown 语法,可以为空。
|
||||
llm_description: 文档内容,支持 markdown 语法,可以为空。
|
||||
form: llm
|
||||
|
||||
- name: folder_token
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: folder_token
|
||||
zh_Hans: 文档所在文件夹的 Token
|
||||
human_description:
|
||||
en_US: |
|
||||
The token of the folder where the document is located. If it is not passed or is empty, it means the root directory. For Example: https://lark-japan.jp.larksuite.com/drive/folder/Lf8uf6BoAlWkUfdGtpMjUV0PpZd
|
||||
zh_Hans: 文档所在文件夹的 Token,不传或传空表示根目录。例如:https://lark-japan.jp.larksuite.com/drive/folder/Lf8uf6BoAlWkUfdGtpMjUV0PpZd。
|
||||
llm_description: 文档所在文件夹的 Token,不传或传空表示根目录。例如:https://lark-japan.jp.larksuite.com/drive/folder/Lf8uf6BoAlWkUfdGtpMjUV0PpZd。
|
||||
form: llm
|
|
@ -0,0 +1,19 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class GetDocumentRawContentTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
document_id = tool_parameters.get("document_id")
|
||||
mode = tool_parameters.get("mode", "markdown")
|
||||
lang = tool_parameters.get("lang", "0")
|
||||
|
||||
res = client.get_document_content(document_id, mode, lang)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,70 @@
|
|||
identity:
|
||||
name: get_document_content
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Get Lark Cloud Document Content
|
||||
zh_Hans: 获取 Lark 云文档的内容
|
||||
description:
|
||||
human:
|
||||
en_US: Get lark cloud document content
|
||||
zh_Hans: 获取 Lark 云文档的内容
|
||||
llm: A tool for retrieving content from Lark cloud documents.
|
||||
parameters:
|
||||
- name: document_id
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: document_id
|
||||
zh_Hans: Lark 文档的唯一标识
|
||||
human_description:
|
||||
en_US: Unique identifier for a Lark document. You can also input the document's URL.
|
||||
zh_Hans: Lark 文档的唯一标识,支持输入文档的 URL。
|
||||
llm_description: Lark 文档的唯一标识,支持输入文档的 URL。
|
||||
form: llm
|
||||
|
||||
- name: mode
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: text
|
||||
label:
|
||||
en_US: text
|
||||
zh_Hans: text
|
||||
- value: markdown
|
||||
label:
|
||||
en_US: markdown
|
||||
zh_Hans: markdown
|
||||
default: "markdown"
|
||||
label:
|
||||
en_US: mode
|
||||
zh_Hans: 文档返回格式
|
||||
human_description:
|
||||
en_US: Format of the document return, optional values are text, markdown, can be empty, default is markdown.
|
||||
zh_Hans: 文档返回格式,可选值有 text、markdown,可以为空,默认值为 markdown。
|
||||
llm_description: 文档返回格式,可选值有 text、markdown,可以为空,默认值为 markdown。
|
||||
form: form
|
||||
|
||||
- name: lang
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: "0"
|
||||
label:
|
||||
en_US: User's default name
|
||||
zh_Hans: 用户的默认名称
|
||||
- value: "1"
|
||||
label:
|
||||
en_US: User's English name
|
||||
zh_Hans: 用户的英文名称
|
||||
default: "0"
|
||||
label:
|
||||
en_US: lang
|
||||
zh_Hans: 指定@用户的语言
|
||||
human_description:
|
||||
en_US: |
|
||||
Specifies the language for MentionUser, optional values are [0, 1]. 0: User's default name, 1: User's English name, default is 0.
|
||||
zh_Hans: |
|
||||
指定返回的 MentionUser,即@用户的语言,可选值有 [0,1]。0: 该用户的默认名称,1: 该用户的英文名称,默认值为 0。
|
||||
llm_description: |
|
||||
指定返回的 MentionUser,即@用户的语言,可选值有 [0,1]。0: 该用户的默认名称,1: 该用户的英文名称,默认值为 0。
|
||||
form: form
|
|
@ -0,0 +1,20 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class ListDocumentBlockTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
document_id = tool_parameters.get("document_id")
|
||||
page_token = tool_parameters.get("page_token", "")
|
||||
user_id_type = tool_parameters.get("user_id_type", "open_id")
|
||||
page_size = tool_parameters.get("page_size", 500)
|
||||
|
||||
res = client.list_document_blocks(document_id, page_token, user_id_type, page_size)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,74 @@
|
|||
identity:
|
||||
name: list_document_blocks
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: List Lark Document Blocks
|
||||
zh_Hans: 获取 Lark 文档所有块
|
||||
description:
|
||||
human:
|
||||
en_US: List lark document blocks
|
||||
zh_Hans: 获取 Lark 文档所有块的富文本内容并分页返回
|
||||
llm: A tool to get all blocks of Lark documents
|
||||
parameters:
|
||||
- name: document_id
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: document_id
|
||||
zh_Hans: Lark 文档的唯一标识
|
||||
human_description:
|
||||
en_US: Unique identifier for a Lark document. You can also input the document's URL.
|
||||
zh_Hans: Lark 文档的唯一标识,支持输入文档的 URL。
|
||||
llm_description: Lark 文档的唯一标识,支持输入文档的 URL。
|
||||
form: llm
|
||||
|
||||
- name: user_id_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: open_id
|
||||
label:
|
||||
en_US: open_id
|
||||
zh_Hans: open_id
|
||||
- value: union_id
|
||||
label:
|
||||
en_US: union_id
|
||||
zh_Hans: union_id
|
||||
- value: user_id
|
||||
label:
|
||||
en_US: user_id
|
||||
zh_Hans: user_id
|
||||
default: "open_id"
|
||||
label:
|
||||
en_US: user_id_type
|
||||
zh_Hans: 用户 ID 类型
|
||||
human_description:
|
||||
en_US: User ID type, optional values are open_id, union_id, user_id, with a default value of open_id.
|
||||
zh_Hans: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
llm_description: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
form: form
|
||||
|
||||
- name: page_size
|
||||
type: number
|
||||
required: false
|
||||
default: 500
|
||||
label:
|
||||
en_US: page_size
|
||||
zh_Hans: 分页大小
|
||||
human_description:
|
||||
en_US: Paging size, the default and maximum value is 500.
|
||||
zh_Hans: 分页大小, 默认值和最大值为 500。
|
||||
llm_description: 分页大小, 表示一次请求最多返回多少条数据,默认值和最大值为 500。
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: page_token
|
||||
zh_Hans: 分页标记
|
||||
human_description:
|
||||
en_US: Pagination token used to navigate through query results, allowing retrieval of additional items in subsequent requests.
|
||||
zh_Hans: 分页标记,用于分页查询结果,以便下次遍历时获取更多项。
|
||||
llm_description: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果。
|
||||
form: llm
|
|
@ -0,0 +1,19 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class CreateDocumentTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
document_id = tool_parameters.get("document_id")
|
||||
content = tool_parameters.get("content")
|
||||
position = tool_parameters.get("position", "end")
|
||||
|
||||
res = client.write_document(document_id, content, position)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,57 @@
|
|||
identity:
|
||||
name: write_document
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Write Document
|
||||
zh_Hans: 在 Lark 文档中新增内容
|
||||
description:
|
||||
human:
|
||||
en_US: Adding new content to Lark documents
|
||||
zh_Hans: 在 Lark 文档中新增内容
|
||||
llm: A tool for adding new content to Lark documents.
|
||||
parameters:
|
||||
- name: document_id
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: document_id
|
||||
zh_Hans: Lark 文档的唯一标识
|
||||
human_description:
|
||||
en_US: Unique identifier for a Lark document. You can also input the document's URL.
|
||||
zh_Hans: Lark 文档的唯一标识,支持输入文档的 URL。
|
||||
llm_description: Lark 文档的唯一标识,支持输入文档的 URL。
|
||||
form: llm
|
||||
|
||||
- name: content
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Plain text or Markdown content
|
||||
zh_Hans: 纯文本或 Markdown 内容
|
||||
human_description:
|
||||
en_US: Plain text or Markdown content. Note that embedded tables in the document should not have merged cells.
|
||||
zh_Hans: 纯文本或 Markdown 内容。注意文档的内嵌套表格不允许有单元格合并。
|
||||
llm_description: 纯文本或 Markdown 内容,注意文档的内嵌套表格不允许有单元格合并。
|
||||
form: llm
|
||||
|
||||
- name: position
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: start
|
||||
label:
|
||||
en_US: document start
|
||||
zh_Hans: 文档开始
|
||||
- value: end
|
||||
label:
|
||||
en_US: document end
|
||||
zh_Hans: 文档结束
|
||||
default: "end"
|
||||
label:
|
||||
en_US: position
|
||||
zh_Hans: 内容添加位置
|
||||
human_description:
|
||||
en_US: Content insertion position, optional values are start, end. 'start' means adding content at the beginning of the document; 'end' means adding content at the end of the document. The default value is end.
|
||||
zh_Hans: 内容添加位置,可选值有 start、end。start 表示在文档开头添加内容;end 表示在文档结尾添加内容,默认值为 end。
|
||||
llm_description: 内容添加位置,可选值有 start、end。start 表示在文档开头添加内容;end 表示在文档结尾添加内容,默认值为 end。
|
||||
form: form
|
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
|
@ -0,0 +1,7 @@
|
|||
from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController
|
||||
from core.tools.utils.lark_api_utils import lark_auth
|
||||
|
||||
|
||||
class LarkMessageAndGroupProvider(BuiltinToolProviderController):
|
||||
def _validate_credentials(self, credentials: dict) -> None:
|
||||
lark_auth(credentials)
|
|
@ -0,0 +1,36 @@
|
|||
identity:
|
||||
author: Doug Lea
|
||||
name: lark_message_and_group
|
||||
label:
|
||||
en_US: Lark Message And Group
|
||||
zh_Hans: Lark 消息和群组
|
||||
description:
|
||||
en_US: |
|
||||
Lark message and group, requires the following permissions: im:message、im:message.group_msg.
|
||||
zh_Hans: |
|
||||
Lark 消息和群组,需要开通以下权限: im:message、im:message.group_msg。
|
||||
icon: icon.png
|
||||
tags:
|
||||
- social
|
||||
- productivity
|
||||
credentials_for_provider:
|
||||
app_id:
|
||||
type: text-input
|
||||
required: true
|
||||
label:
|
||||
en_US: APP ID
|
||||
placeholder:
|
||||
en_US: Please input your Lark app id
|
||||
zh_Hans: 请输入你的 Lark app id
|
||||
help:
|
||||
en_US: Get your app_id and app_secret from Lark
|
||||
zh_Hans: 从 Lark 获取您的 app_id 和 app_secret
|
||||
url: https://open.larksuite.com/app
|
||||
app_secret:
|
||||
type: secret-input
|
||||
required: true
|
||||
label:
|
||||
en_US: APP Secret
|
||||
placeholder:
|
||||
en_US: Please input your app secret
|
||||
zh_Hans: 请输入你的 Lark app secret
|
|
@ -0,0 +1,23 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class GetChatMessagesTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
container_id = tool_parameters.get("container_id")
|
||||
start_time = tool_parameters.get("start_time")
|
||||
end_time = tool_parameters.get("end_time")
|
||||
page_token = tool_parameters.get("page_token")
|
||||
sort_type = tool_parameters.get("sort_type", "ByCreateTimeAsc")
|
||||
page_size = tool_parameters.get("page_size", 20)
|
||||
|
||||
res = client.get_chat_messages(container_id, start_time, end_time, page_token, sort_type, page_size)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,96 @@
|
|||
identity:
|
||||
name: get_chat_messages
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Get Chat Messages
|
||||
zh_Hans: 获取指定单聊、群聊的消息历史
|
||||
description:
|
||||
human:
|
||||
en_US: Get Chat Messages
|
||||
zh_Hans: 获取指定单聊、群聊的消息历史
|
||||
llm: A tool for getting chat messages from specific one-on-one chats or group chats.(获取指定单聊、群聊的消息历史)
|
||||
parameters:
|
||||
- name: container_id
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Container Id
|
||||
zh_Hans: 群聊或单聊的 ID
|
||||
human_description:
|
||||
en_US: The ID of the group chat or single chat. Refer to the group ID description for how to obtain it. https://open.larkoffice.com/document/server-docs/group/chat/chat-id-description
|
||||
zh_Hans: 群聊或单聊的 ID,获取方式参见群 ID 说明。https://open.larkoffice.com/document/server-docs/group/chat/chat-id-description
|
||||
llm_description: 群聊或单聊的 ID,获取方式参见群 ID 说明。https://open.larkoffice.com/document/server-docs/group/chat/chat-id-description
|
||||
form: llm
|
||||
|
||||
- name: start_time
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Start Time
|
||||
zh_Hans: 起始时间
|
||||
human_description:
|
||||
en_US: The start time for querying historical messages, formatted as "2006-01-02 15:04:05".
|
||||
zh_Hans: 待查询历史信息的起始时间,格式为 "2006-01-02 15:04:05"。
|
||||
llm_description: 待查询历史信息的起始时间,格式为 "2006-01-02 15:04:05"。
|
||||
form: llm
|
||||
|
||||
- name: end_time
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: End Time
|
||||
zh_Hans: 结束时间
|
||||
human_description:
|
||||
en_US: The end time for querying historical messages, formatted as "2006-01-02 15:04:05".
|
||||
zh_Hans: 待查询历史信息的结束时间,格式为 "2006-01-02 15:04:05"。
|
||||
llm_description: 待查询历史信息的结束时间,格式为 "2006-01-02 15:04:05"。
|
||||
form: llm
|
||||
|
||||
- name: sort_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: ByCreateTimeAsc
|
||||
label:
|
||||
en_US: ByCreateTimeAsc
|
||||
zh_Hans: ByCreateTimeAsc
|
||||
- value: ByCreateTimeDesc
|
||||
label:
|
||||
en_US: ByCreateTimeDesc
|
||||
zh_Hans: ByCreateTimeDesc
|
||||
default: "ByCreateTimeAsc"
|
||||
label:
|
||||
en_US: Sort Type
|
||||
zh_Hans: 排序方式
|
||||
human_description:
|
||||
en_US: |
|
||||
The message sorting method. Optional values are ByCreateTimeAsc: sorted in ascending order by message creation time; ByCreateTimeDesc: sorted in descending order by message creation time. The default value is ByCreateTimeAsc. Note: When using page_token for pagination requests, the sorting method (sort_type) is consistent with the first request and cannot be changed midway.
|
||||
zh_Hans: |
|
||||
消息排序方式,可选值有 ByCreateTimeAsc:按消息创建时间升序排列;ByCreateTimeDesc:按消息创建时间降序排列。默认值为:ByCreateTimeAsc。注意:使用 page_token 分页请求时,排序方式(sort_type)均与第一次请求一致,不支持中途改换排序方式。
|
||||
llm_description: 消息排序方式,可选值有 ByCreateTimeAsc:按消息创建时间升序排列;ByCreateTimeDesc:按消息创建时间降序排列。默认值为:ByCreateTimeAsc。注意:使用 page_token 分页请求时,排序方式(sort_type)均与第一次请求一致,不支持中途改换排序方式。
|
||||
form: form
|
||||
|
||||
- name: page_size
|
||||
type: number
|
||||
required: false
|
||||
default: 20
|
||||
label:
|
||||
en_US: Page Size
|
||||
zh_Hans: 分页大小
|
||||
human_description:
|
||||
en_US: The page size, i.e., the number of data entries returned in a single request. The default value is 20, and the value range is [1,50].
|
||||
zh_Hans: 分页大小,即单次请求所返回的数据条目数。默认值为 20,取值范围为 [1,50]。
|
||||
llm_description: 分页大小,即单次请求所返回的数据条目数。默认值为 20,取值范围为 [1,50]。
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Page Token
|
||||
zh_Hans: 分页标记
|
||||
human_description:
|
||||
en_US: The pagination token. Leave it blank for the first request, indicating to start traversing from the beginning; when the pagination query result has more items, a new page_token will be returned simultaneously, which can be used to obtain the query result in the next traversal.
|
||||
zh_Hans: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果。
|
||||
llm_description: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果。
|
||||
form: llm
|
|
@ -0,0 +1,21 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class GetChatMessagesTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
container_id = tool_parameters.get("container_id")
|
||||
page_token = tool_parameters.get("page_token")
|
||||
sort_type = tool_parameters.get("sort_type", "ByCreateTimeAsc")
|
||||
page_size = tool_parameters.get("page_size", 20)
|
||||
|
||||
res = client.get_thread_messages(container_id, page_token, sort_type, page_size)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,72 @@
|
|||
identity:
|
||||
name: get_thread_messages
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Get Thread Messages
|
||||
zh_Hans: 获取指定话题的消息历史
|
||||
description:
|
||||
human:
|
||||
en_US: Get Thread Messages
|
||||
zh_Hans: 获取指定话题的消息历史
|
||||
llm: A tool for getting chat messages from specific threads.(获取指定话题的消息历史)
|
||||
parameters:
|
||||
- name: container_id
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Thread Id
|
||||
zh_Hans: 话题 ID
|
||||
human_description:
|
||||
en_US: The ID of the thread. Refer to the thread overview on how to obtain the thread_id. https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/thread-introduction
|
||||
zh_Hans: 话题 ID,获取方式参见话题概述的如何获取 thread_id 章节。https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/thread-introduction
|
||||
llm_description: 话题 ID,获取方式参见话题概述的如何获取 thread_id 章节。https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/thread-introduction
|
||||
form: llm
|
||||
|
||||
- name: sort_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: ByCreateTimeAsc
|
||||
label:
|
||||
en_US: ByCreateTimeAsc
|
||||
zh_Hans: ByCreateTimeAsc
|
||||
- value: ByCreateTimeDesc
|
||||
label:
|
||||
en_US: ByCreateTimeDesc
|
||||
zh_Hans: ByCreateTimeDesc
|
||||
default: "ByCreateTimeAsc"
|
||||
label:
|
||||
en_US: Sort Type
|
||||
zh_Hans: 排序方式
|
||||
human_description:
|
||||
en_US: |
|
||||
The message sorting method. Optional values are ByCreateTimeAsc: sorted in ascending order by message creation time; ByCreateTimeDesc: sorted in descending order by message creation time. The default value is ByCreateTimeAsc. Note: When using page_token for pagination requests, the sorting method (sort_type) is consistent with the first request and cannot be changed midway.
|
||||
zh_Hans: |
|
||||
消息排序方式,可选值有 ByCreateTimeAsc:按消息创建时间升序排列;ByCreateTimeDesc:按消息创建时间降序排列。默认值为:ByCreateTimeAsc。注意:使用 page_token 分页请求时,排序方式(sort_type)均与第一次请求一致,不支持中途改换排序方式。
|
||||
llm_description: 消息排序方式,可选值有 ByCreateTimeAsc:按消息创建时间升序排列;ByCreateTimeDesc:按消息创建时间降序排列。默认值为:ByCreateTimeAsc。注意:使用 page_token 分页请求时,排序方式(sort_type)均与第一次请求一致,不支持中途改换排序方式。
|
||||
form: form
|
||||
|
||||
- name: page_size
|
||||
type: number
|
||||
required: false
|
||||
default: 20
|
||||
label:
|
||||
en_US: Page Size
|
||||
zh_Hans: 分页大小
|
||||
human_description:
|
||||
en_US: The page size, i.e., the number of data entries returned in a single request. The default value is 20, and the value range is [1,50].
|
||||
zh_Hans: 分页大小,即单次请求所返回的数据条目数。默认值为 20,取值范围为 [1,50]。
|
||||
llm_description: 分页大小,即单次请求所返回的数据条目数。默认值为 20,取值范围为 [1,50]。
|
||||
form: form
|
||||
|
||||
- name: page_token
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Page Token
|
||||
zh_Hans: 分页标记
|
||||
human_description:
|
||||
en_US: The pagination token. Leave it blank for the first request, indicating to start traversing from the beginning; when the pagination query result has more items, a new page_token will be returned simultaneously, which can be used to obtain the query result in the next traversal.
|
||||
zh_Hans: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果。
|
||||
llm_description: 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果。
|
||||
form: llm
|
|
@ -0,0 +1,20 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class SendBotMessageTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
receive_id_type = tool_parameters.get("receive_id_type")
|
||||
receive_id = tool_parameters.get("receive_id")
|
||||
msg_type = tool_parameters.get("msg_type")
|
||||
content = tool_parameters.get("content")
|
||||
|
||||
res = client.send_bot_message(receive_id_type, receive_id, msg_type, content)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,125 @@
|
|||
identity:
|
||||
name: send_bot_message
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Send Bot Message
|
||||
zh_Hans: 发送 Lark 应用消息
|
||||
description:
|
||||
human:
|
||||
en_US: Send bot message
|
||||
zh_Hans: 发送 Lark 应用消息
|
||||
llm: A tool for sending Lark application messages.
|
||||
parameters:
|
||||
- name: receive_id
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: receive_id
|
||||
zh_Hans: 消息接收者的 ID
|
||||
human_description:
|
||||
en_US: The ID of the message receiver, the ID type is consistent with the value of the query parameter receive_id_type.
|
||||
zh_Hans: 消息接收者的 ID,ID 类型与查询参数 receive_id_type 的取值一致。
|
||||
llm_description: 消息接收者的 ID,ID 类型与查询参数 receive_id_type 的取值一致。
|
||||
form: llm
|
||||
|
||||
- name: receive_id_type
|
||||
type: select
|
||||
required: true
|
||||
options:
|
||||
- value: open_id
|
||||
label:
|
||||
en_US: open_id
|
||||
zh_Hans: open_id
|
||||
- value: union_id
|
||||
label:
|
||||
en_US: union_id
|
||||
zh_Hans: union_id
|
||||
- value: user_id
|
||||
label:
|
||||
en_US: user_id
|
||||
zh_Hans: user_id
|
||||
- value: email
|
||||
label:
|
||||
en_US: email
|
||||
zh_Hans: email
|
||||
- value: chat_id
|
||||
label:
|
||||
en_US: chat_id
|
||||
zh_Hans: chat_id
|
||||
label:
|
||||
en_US: receive_id_type
|
||||
zh_Hans: 消息接收者的 ID 类型
|
||||
human_description:
|
||||
en_US: The ID type of the message receiver, optional values are open_id, union_id, user_id, email, chat_id, with a default value of open_id.
|
||||
zh_Hans: 消息接收者的 ID 类型,可选值有 open_id、union_id、user_id、email、chat_id,默认值为 open_id。
|
||||
llm_description: 消息接收者的 ID 类型,可选值有 open_id、union_id、user_id、email、chat_id,默认值为 open_id。
|
||||
form: form
|
||||
|
||||
- name: msg_type
|
||||
type: select
|
||||
required: true
|
||||
options:
|
||||
- value: text
|
||||
label:
|
||||
en_US: text
|
||||
zh_Hans: 文本
|
||||
- value: interactive
|
||||
label:
|
||||
en_US: interactive
|
||||
zh_Hans: 卡片
|
||||
- value: post
|
||||
label:
|
||||
en_US: post
|
||||
zh_Hans: 富文本
|
||||
- value: image
|
||||
label:
|
||||
en_US: image
|
||||
zh_Hans: 图片
|
||||
- value: file
|
||||
label:
|
||||
en_US: file
|
||||
zh_Hans: 文件
|
||||
- value: audio
|
||||
label:
|
||||
en_US: audio
|
||||
zh_Hans: 语音
|
||||
- value: media
|
||||
label:
|
||||
en_US: media
|
||||
zh_Hans: 视频
|
||||
- value: sticker
|
||||
label:
|
||||
en_US: sticker
|
||||
zh_Hans: 表情包
|
||||
- value: share_chat
|
||||
label:
|
||||
en_US: share_chat
|
||||
zh_Hans: 分享群名片
|
||||
- value: share_user
|
||||
label:
|
||||
en_US: share_user
|
||||
zh_Hans: 分享个人名片
|
||||
- value: system
|
||||
label:
|
||||
en_US: system
|
||||
zh_Hans: 系统消息
|
||||
label:
|
||||
en_US: msg_type
|
||||
zh_Hans: 消息类型
|
||||
human_description:
|
||||
en_US: Message type. Optional values are text, post, image, file, audio, media, sticker, interactive, share_chat, share_user, system. For detailed introduction of different message types, refer to the message content(https://open.larkoffice.com/document/server-docs/im-v1/message-content-description/create_json).
|
||||
zh_Hans: 消息类型。可选值有:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user、system。不同消息类型的详细介绍,参见发送消息内容(https://open.larkoffice.com/document/server-docs/im-v1/message-content-description/create_json)。
|
||||
llm_description: 消息类型。可选值有:text、post、image、file、audio、media、sticker、interactive、share_chat、share_user、system。不同消息类型的详细介绍,参见发送消息内容(https://open.larkoffice.com/document/server-docs/im-v1/message-content-description/create_json)。
|
||||
form: form
|
||||
|
||||
- name: content
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: content
|
||||
zh_Hans: 消息内容
|
||||
human_description:
|
||||
en_US: Message content, a JSON structure serialized string. The value of this parameter corresponds to msg_type. For example, if msg_type is text, this parameter needs to pass in text type content. To understand the format and usage limitations of different message types, refer to the message content(https://open.larksuite.com/document/server-docs/im-v1/message-content-description/create_json).
|
||||
zh_Hans: 消息内容,JSON 结构序列化后的字符串。该参数的取值与 msg_type 对应,例如 msg_type 取值为 text,则该参数需要传入文本类型的内容。了解不同类型的消息内容格式、使用限制,可参见发送消息内容(https://open.larksuite.com/document/server-docs/im-v1/message-content-description/create_json)。
|
||||
llm_description: 消息内容,JSON 结构序列化后的字符串。该参数的取值与 msg_type 对应,例如 msg_type 取值为 text,则该参数需要传入文本类型的内容。了解不同类型的消息内容格式、使用限制,可参见发送消息内容(https://open.larksuite.com/document/server-docs/im-v1/message-content-description/create_json)。
|
||||
form: llm
|
|
@ -0,0 +1,19 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class SendWebhookMessageTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
webhook = tool_parameters.get("webhook")
|
||||
msg_type = tool_parameters.get("msg_type")
|
||||
content = tool_parameters.get("content")
|
||||
|
||||
res = client.send_webhook_message(webhook, msg_type, content)
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,68 @@
|
|||
identity:
|
||||
name: send_webhook_message
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Send Webhook Message
|
||||
zh_Hans: 使用自定义机器人发送 Lark 消息
|
||||
description:
|
||||
human:
|
||||
en_US: Send webhook message
|
||||
zh_Hans: 使用自定义机器人发送 Lark 消息
|
||||
llm: A tool for sending Lark messages using a custom robot.
|
||||
parameters:
|
||||
- name: webhook
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: webhook
|
||||
zh_Hans: webhook
|
||||
human_description:
|
||||
en_US: |
|
||||
The address of the webhook, the format of the webhook address corresponding to the bot is as follows: https://open.larksuite.com/open-apis/bot/v2/hook/xxxxxxxxxxxxxxxxx. For details, please refer to: Lark Custom Bot Usage Guide(https://open.larkoffice.com/document/client-docs/bot-v3/add-custom-bot)
|
||||
zh_Hans: |
|
||||
webhook 的地址,机器人对应的 webhook 地址格式如下: https://open.larksuite.com/open-apis/bot/v2/hook/xxxxxxxxxxxxxxxxx,详情可参考: Lark 自定义机器人使用指南(https://open.larksuite.com/document/client-docs/bot-v3/add-custom-bot)
|
||||
llm_description: |
|
||||
webhook 的地址,机器人对应的 webhook 地址格式如下: https://open.larksuite.com/open-apis/bot/v2/hook/xxxxxxxxxxxxxxxxx,详情可参考: Lark 自定义机器人使用指南(https://open.larksuite.com/document/client-docs/bot-v3/add-custom-bot)
|
||||
form: llm
|
||||
|
||||
- name: msg_type
|
||||
type: select
|
||||
required: true
|
||||
options:
|
||||
- value: text
|
||||
label:
|
||||
en_US: text
|
||||
zh_Hans: 文本
|
||||
- value: interactive
|
||||
label:
|
||||
en_US: interactive
|
||||
zh_Hans: 卡片
|
||||
- value: image
|
||||
label:
|
||||
en_US: image
|
||||
zh_Hans: 图片
|
||||
- value: share_chat
|
||||
label:
|
||||
en_US: share_chat
|
||||
zh_Hans: 分享群名片
|
||||
label:
|
||||
en_US: msg_type
|
||||
zh_Hans: 消息类型
|
||||
human_description:
|
||||
en_US: Message type. Optional values are text, image, interactive, share_chat. For detailed introduction of different message types, refer to the message content(https://open.larkoffice.com/document/server-docs/im-v1/message-content-description/create_json).
|
||||
zh_Hans: 消息类型。可选值有:text、image、interactive、share_chat。不同消息类型的详细介绍,参见发送消息内容(https://open.larkoffice.com/document/server-docs/im-v1/message-content-description/create_json)。
|
||||
llm_description: 消息类型。可选值有:text、image、interactive、share_chat。不同消息类型的详细介绍,参见发送消息内容(https://open.larkoffice.com/document/server-docs/im-v1/message-content-description/create_json)。
|
||||
form: form
|
||||
|
||||
|
||||
- name: content
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: content
|
||||
zh_Hans: 消息内容
|
||||
human_description:
|
||||
en_US: Message content, a JSON structure serialized string. The value of this parameter corresponds to msg_type. For example, if msg_type is text, this parameter needs to pass in text type content. To understand the format and usage limitations of different message types, refer to the message content(https://open.larkoffice.com/document/server-docs/im-v1/message-content-description/create_json).
|
||||
zh_Hans: 消息内容,JSON 结构序列化后的字符串。该参数的取值与 msg_type 对应,例如 msg_type 取值为 text,则该参数需要传入文本类型的内容。了解不同类型的消息内容格式、使用限制,可参见发送消息内容(https://open.larkoffice.com/document/server-docs/im-v1/message-content-description/create_json)。
|
||||
llm_description: 消息内容,JSON 结构序列化后的字符串。该参数的取值与 msg_type 对应,例如 msg_type 取值为 text,则该参数需要传入文本类型的内容。了解不同类型的消息内容格式、使用限制,可参见发送消息内容(https://open.larkoffice.com/document/server-docs/im-v1/message-content-description/create_json)。
|
||||
form: llm
|
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
|
@ -0,0 +1,7 @@
|
|||
from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController
|
||||
from core.tools.utils.lark_api_utils import lark_auth
|
||||
|
||||
|
||||
class LarkMessageProvider(BuiltinToolProviderController):
|
||||
def _validate_credentials(self, credentials: dict) -> None:
|
||||
lark_auth(credentials)
|
|
@ -0,0 +1,36 @@
|
|||
identity:
|
||||
author: Doug Lea
|
||||
name: lark_spreadsheet
|
||||
label:
|
||||
en_US: Lark Spreadsheet
|
||||
zh_Hans: Lark 电子表格
|
||||
description:
|
||||
en_US: |
|
||||
Lark Spreadsheet, requires the following permissions: sheets:spreadsheet.
|
||||
zh_Hans: |
|
||||
Lark 电子表格,需要开通以下权限: sheets:spreadsheet。
|
||||
icon: icon.png
|
||||
tags:
|
||||
- social
|
||||
- productivity
|
||||
credentials_for_provider:
|
||||
app_id:
|
||||
type: text-input
|
||||
required: true
|
||||
label:
|
||||
en_US: APP ID
|
||||
placeholder:
|
||||
en_US: Please input your Lark app id
|
||||
zh_Hans: 请输入你的 Lark app id
|
||||
help:
|
||||
en_US: Get your app_id and app_secret from Lark
|
||||
zh_Hans: 从 Lark 获取您的 app_id 和 app_secret
|
||||
url: https://open.larksuite.com/app
|
||||
app_secret:
|
||||
type: secret-input
|
||||
required: true
|
||||
label:
|
||||
en_US: APP Secret
|
||||
placeholder:
|
||||
en_US: Please input your app secret
|
||||
zh_Hans: 请输入你的 Lark app secret
|
|
@ -0,0 +1,22 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class AddColsTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
spreadsheet_token = tool_parameters.get("spreadsheet_token")
|
||||
sheet_id = tool_parameters.get("sheet_id")
|
||||
sheet_name = tool_parameters.get("sheet_name")
|
||||
length = tool_parameters.get("length")
|
||||
values = tool_parameters.get("values")
|
||||
|
||||
res = client.add_cols(spreadsheet_token, sheet_id, sheet_name, length, values)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,72 @@
|
|||
identity:
|
||||
name: add_cols
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Add Cols
|
||||
zh_Hans: 新增多列至工作表最后
|
||||
description:
|
||||
human:
|
||||
en_US: Add Cols
|
||||
zh_Hans: 新增多列至工作表最后
|
||||
llm: A tool for adding multiple columns to the end of a spreadsheet. (新增多列至工作表最后)
|
||||
parameters:
|
||||
- name: spreadsheet_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: spreadsheet_token
|
||||
zh_Hans: 电子表格 token
|
||||
human_description:
|
||||
en_US: Spreadsheet token, supports input of spreadsheet URL.
|
||||
zh_Hans: 电子表格 token,支持输入电子表格 url。
|
||||
llm_description: 电子表格 token,支持输入电子表格 url。
|
||||
form: llm
|
||||
|
||||
- name: sheet_id
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: sheet_id
|
||||
zh_Hans: 工作表 ID
|
||||
human_description:
|
||||
en_US: Sheet ID, either sheet_id or sheet_name must be filled.
|
||||
zh_Hans: 工作表 ID,与 sheet_name 二者其一必填。
|
||||
llm_description: 工作表 ID,与 sheet_name 二者其一必填。
|
||||
form: llm
|
||||
|
||||
- name: sheet_name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: sheet_name
|
||||
zh_Hans: 工作表名称
|
||||
human_description:
|
||||
en_US: Sheet name, either sheet_id or sheet_name must be filled.
|
||||
zh_Hans: 工作表名称,与 sheet_id 二者其一必填。
|
||||
llm_description: 工作表名称,与 sheet_id 二者其一必填。
|
||||
form: llm
|
||||
|
||||
- name: length
|
||||
type: number
|
||||
required: true
|
||||
label:
|
||||
en_US: length
|
||||
zh_Hans: 要增加的列数
|
||||
human_description:
|
||||
en_US: Number of columns to add, range (0-5000].
|
||||
zh_Hans: 要增加的列数,范围(0-5000]。
|
||||
llm_description: 要增加的列数,范围(0-5000]。
|
||||
form: form
|
||||
|
||||
- name: values
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: values
|
||||
zh_Hans: 新增列的单元格内容
|
||||
human_description:
|
||||
en_US: |
|
||||
Content of the new columns, array of objects in string format, each array represents a row of table data, format like: [ [ "ID","Name","Age" ],[ 1,"Zhang San",10 ],[ 2,"Li Si",11 ] ].
|
||||
zh_Hans: 新增列的单元格内容,数组对象字符串,每个数组一行表格数据,格式:[["编号","姓名","年龄"],[1,"张三",10],[2,"李四",11]]。
|
||||
llm_description: 新增列的单元格内容,数组对象字符串,每个数组一行表格数据,格式:[["编号","姓名","年龄"],[1,"张三",10],[2,"李四",11]]。
|
||||
form: llm
|
|
@ -0,0 +1,22 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class AddRowsTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
spreadsheet_token = tool_parameters.get("spreadsheet_token")
|
||||
sheet_id = tool_parameters.get("sheet_id")
|
||||
sheet_name = tool_parameters.get("sheet_name")
|
||||
length = tool_parameters.get("length")
|
||||
values = tool_parameters.get("values")
|
||||
|
||||
res = client.add_rows(spreadsheet_token, sheet_id, sheet_name, length, values)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,72 @@
|
|||
identity:
|
||||
name: add_rows
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Add Rows
|
||||
zh_Hans: 新增多行至工作表最后
|
||||
description:
|
||||
human:
|
||||
en_US: Add Rows
|
||||
zh_Hans: 新增多行至工作表最后
|
||||
llm: A tool for adding multiple rows to the end of a spreadsheet. (新增多行至工作表最后)
|
||||
parameters:
|
||||
- name: spreadsheet_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: spreadsheet_token
|
||||
zh_Hans: 电子表格 token
|
||||
human_description:
|
||||
en_US: Spreadsheet token, supports input of spreadsheet URL.
|
||||
zh_Hans: 电子表格 token,支持输入电子表格 url。
|
||||
llm_description: 电子表格 token,支持输入电子表格 url。
|
||||
form: llm
|
||||
|
||||
- name: sheet_id
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: sheet_id
|
||||
zh_Hans: 工作表 ID
|
||||
human_description:
|
||||
en_US: Sheet ID, either sheet_id or sheet_name must be filled.
|
||||
zh_Hans: 工作表 ID,与 sheet_name 二者其一必填。
|
||||
llm_description: 工作表 ID,与 sheet_name 二者其一必填。
|
||||
form: llm
|
||||
|
||||
- name: sheet_name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: sheet_name
|
||||
zh_Hans: 工作表名称
|
||||
human_description:
|
||||
en_US: Sheet name, either sheet_id or sheet_name must be filled.
|
||||
zh_Hans: 工作表名称,与 sheet_id 二者其一必填。
|
||||
llm_description: 工作表名称,与 sheet_id 二者其一必填。
|
||||
form: llm
|
||||
|
||||
- name: length
|
||||
type: number
|
||||
required: true
|
||||
label:
|
||||
en_US: length
|
||||
zh_Hans: 要增加行数
|
||||
human_description:
|
||||
en_US: Number of rows to add, range (0-5000].
|
||||
zh_Hans: 要增加行数,范围(0-5000]。
|
||||
llm_description: 要增加行数,范围(0-5000]。
|
||||
form: form
|
||||
|
||||
- name: values
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: values
|
||||
zh_Hans: 新增行的表格内容
|
||||
human_description:
|
||||
en_US: |
|
||||
Content of the new rows, array of objects in string format, each array represents a row of table data, format like: [ [ "ID","Name","Age" ],[ 1,"Zhang San",10 ],[ 2,"Li Si",11 ] ].
|
||||
zh_Hans: 新增行的表格内容,数组对象字符串,每个数组一行表格数据,格式,如:[["编号","姓名","年龄"],[1,"张三",10],[2,"李四",11]]。
|
||||
llm_description: 新增行的表格内容,数组对象字符串,每个数组一行表格数据,格式,如:[["编号","姓名","年龄"],[1,"张三",10],[2,"李四",11]]。
|
||||
form: llm
|
|
@ -0,0 +1,19 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class CreateSpreadsheetTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
title = tool_parameters.get("title")
|
||||
folder_token = tool_parameters.get("folder_token")
|
||||
|
||||
res = client.create_spreadsheet(title, folder_token)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,35 @@
|
|||
identity:
|
||||
name: create_spreadsheet
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Create Spreadsheet
|
||||
zh_Hans: 创建电子表格
|
||||
description:
|
||||
human:
|
||||
en_US: Create Spreadsheet
|
||||
zh_Hans: 创建电子表格
|
||||
llm: A tool for creating spreadsheets. (创建电子表格)
|
||||
parameters:
|
||||
- name: title
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Spreadsheet Title
|
||||
zh_Hans: 电子表格标题
|
||||
human_description:
|
||||
en_US: The title of the spreadsheet
|
||||
zh_Hans: 电子表格的标题
|
||||
llm_description: 电子表格的标题
|
||||
form: llm
|
||||
|
||||
- name: folder_token
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: Folder Token
|
||||
zh_Hans: 文件夹 token
|
||||
human_description:
|
||||
en_US: The token of the folder, supports folder URL input, e.g., https://bytedance.larkoffice.com/drive/folder/CxHEf4DCSlNkL2dUTCJcPRgentg
|
||||
zh_Hans: 文件夹 token,支持文件夹 URL 输入,如:https://bytedance.larkoffice.com/drive/folder/CxHEf4DCSlNkL2dUTCJcPRgentg
|
||||
llm_description: 文件夹 token,支持文件夹 URL 输入,如:https://bytedance.larkoffice.com/drive/folder/CxHEf4DCSlNkL2dUTCJcPRgentg
|
||||
form: llm
|
|
@ -0,0 +1,19 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class GetSpreadsheetTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
spreadsheet_token = tool_parameters.get("spreadsheet_token")
|
||||
user_id_type = tool_parameters.get("user_id_type", "open_id")
|
||||
|
||||
res = client.get_spreadsheet(spreadsheet_token, user_id_type)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,49 @@
|
|||
identity:
|
||||
name: get_spreadsheet
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Get Spreadsheet
|
||||
zh_Hans: 获取电子表格信息
|
||||
description:
|
||||
human:
|
||||
en_US: Get Spreadsheet
|
||||
zh_Hans: 获取电子表格信息
|
||||
llm: A tool for getting information from spreadsheets. (获取电子表格信息)
|
||||
parameters:
|
||||
- name: spreadsheet_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Spreadsheet Token
|
||||
zh_Hans: 电子表格 token
|
||||
human_description:
|
||||
en_US: Spreadsheet token, supports input of spreadsheet URL.
|
||||
zh_Hans: 电子表格 token,支持输入电子表格 URL。
|
||||
llm_description: 电子表格 token,支持输入电子表格 URL。
|
||||
form: llm
|
||||
|
||||
- name: user_id_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: open_id
|
||||
label:
|
||||
en_US: open_id
|
||||
zh_Hans: open_id
|
||||
- value: union_id
|
||||
label:
|
||||
en_US: union_id
|
||||
zh_Hans: union_id
|
||||
- value: user_id
|
||||
label:
|
||||
en_US: user_id
|
||||
zh_Hans: user_id
|
||||
default: "open_id"
|
||||
label:
|
||||
en_US: user_id_type
|
||||
zh_Hans: 用户 ID 类型
|
||||
human_description:
|
||||
en_US: User ID type, optional values are open_id, union_id, user_id, with a default value of open_id.
|
||||
zh_Hans: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
llm_description: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
form: form
|
|
@ -0,0 +1,18 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class ListSpreadsheetSheetsTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
spreadsheet_token = tool_parameters.get("spreadsheet_token")
|
||||
|
||||
res = client.list_spreadsheet_sheets(spreadsheet_token)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,23 @@
|
|||
identity:
|
||||
name: list_spreadsheet_sheets
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: List Spreadsheet Sheets
|
||||
zh_Hans: 列出电子表格所有工作表
|
||||
description:
|
||||
human:
|
||||
en_US: List Spreadsheet Sheets
|
||||
zh_Hans: 列出电子表格所有工作表
|
||||
llm: A tool for listing all sheets in a spreadsheet. (列出电子表格所有工作表)
|
||||
parameters:
|
||||
- name: spreadsheet_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Spreadsheet Token
|
||||
zh_Hans: 电子表格 token
|
||||
human_description:
|
||||
en_US: Spreadsheet token, supports input of spreadsheet URL.
|
||||
zh_Hans: 电子表格 token,支持输入电子表格 URL。
|
||||
llm_description: 电子表格 token,支持输入电子表格 URL。
|
||||
form: llm
|
|
@ -0,0 +1,23 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class ReadColsTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
spreadsheet_token = tool_parameters.get("spreadsheet_token")
|
||||
sheet_id = tool_parameters.get("sheet_id")
|
||||
sheet_name = tool_parameters.get("sheet_name")
|
||||
start_col = tool_parameters.get("start_col")
|
||||
num_cols = tool_parameters.get("num_cols")
|
||||
user_id_type = tool_parameters.get("user_id_type", "open_id")
|
||||
|
||||
res = client.read_cols(spreadsheet_token, sheet_id, sheet_name, start_col, num_cols, user_id_type)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,97 @@
|
|||
identity:
|
||||
name: read_cols
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Read Cols
|
||||
zh_Hans: 读取工作表列数据
|
||||
description:
|
||||
human:
|
||||
en_US: Read Cols
|
||||
zh_Hans: 读取工作表列数据
|
||||
llm: A tool for reading column data from a spreadsheet. (读取工作表列数据)
|
||||
parameters:
|
||||
- name: spreadsheet_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: spreadsheet_token
|
||||
zh_Hans: 电子表格 token
|
||||
human_description:
|
||||
en_US: Spreadsheet token, supports input of spreadsheet URL.
|
||||
zh_Hans: 电子表格 token,支持输入电子表格 url。
|
||||
llm_description: 电子表格 token,支持输入电子表格 url。
|
||||
form: llm
|
||||
|
||||
- name: sheet_id
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: sheet_id
|
||||
zh_Hans: 工作表 ID
|
||||
human_description:
|
||||
en_US: Sheet ID, either sheet_id or sheet_name must be filled.
|
||||
zh_Hans: 工作表 ID,与 sheet_name 二者其一必填。
|
||||
llm_description: 工作表 ID,与 sheet_name 二者其一必填。
|
||||
form: llm
|
||||
|
||||
- name: sheet_name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: sheet_name
|
||||
zh_Hans: 工作表名称
|
||||
human_description:
|
||||
en_US: Sheet name, either sheet_id or sheet_name must be filled.
|
||||
zh_Hans: 工作表名称,与 sheet_id 二者其一必填。
|
||||
llm_description: 工作表名称,与 sheet_id 二者其一必填。
|
||||
form: llm
|
||||
|
||||
- name: user_id_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: open_id
|
||||
label:
|
||||
en_US: open_id
|
||||
zh_Hans: open_id
|
||||
- value: union_id
|
||||
label:
|
||||
en_US: union_id
|
||||
zh_Hans: union_id
|
||||
- value: user_id
|
||||
label:
|
||||
en_US: user_id
|
||||
zh_Hans: user_id
|
||||
default: "open_id"
|
||||
label:
|
||||
en_US: user_id_type
|
||||
zh_Hans: 用户 ID 类型
|
||||
human_description:
|
||||
en_US: User ID type, optional values are open_id, union_id, user_id, with a default value of open_id.
|
||||
zh_Hans: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
llm_description: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
form: form
|
||||
|
||||
- name: start_col
|
||||
type: number
|
||||
required: false
|
||||
label:
|
||||
en_US: start_col
|
||||
zh_Hans: 起始列号
|
||||
human_description:
|
||||
en_US: Starting column number, starting from 1.
|
||||
zh_Hans: 起始列号,从 1 开始。
|
||||
llm_description: 起始列号,从 1 开始。
|
||||
form: form
|
||||
|
||||
- name: num_cols
|
||||
type: number
|
||||
required: true
|
||||
label:
|
||||
en_US: num_cols
|
||||
zh_Hans: 读取列数
|
||||
human_description:
|
||||
en_US: Number of columns to read.
|
||||
zh_Hans: 读取列数
|
||||
llm_description: 读取列数
|
||||
form: form
|
|
@ -0,0 +1,23 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class ReadRowsTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
spreadsheet_token = tool_parameters.get("spreadsheet_token")
|
||||
sheet_id = tool_parameters.get("sheet_id")
|
||||
sheet_name = tool_parameters.get("sheet_name")
|
||||
start_row = tool_parameters.get("start_row")
|
||||
num_rows = tool_parameters.get("num_rows")
|
||||
user_id_type = tool_parameters.get("user_id_type", "open_id")
|
||||
|
||||
res = client.read_rows(spreadsheet_token, sheet_id, sheet_name, start_row, num_rows, user_id_type)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,97 @@
|
|||
identity:
|
||||
name: read_rows
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Read Rows
|
||||
zh_Hans: 读取工作表行数据
|
||||
description:
|
||||
human:
|
||||
en_US: Read Rows
|
||||
zh_Hans: 读取工作表行数据
|
||||
llm: A tool for reading row data from a spreadsheet. (读取工作表行数据)
|
||||
parameters:
|
||||
- name: spreadsheet_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: spreadsheet_token
|
||||
zh_Hans: 电子表格 token
|
||||
human_description:
|
||||
en_US: Spreadsheet token, supports input of spreadsheet URL.
|
||||
zh_Hans: 电子表格 token,支持输入电子表格 url。
|
||||
llm_description: 电子表格 token,支持输入电子表格 url。
|
||||
form: llm
|
||||
|
||||
- name: sheet_id
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: sheet_id
|
||||
zh_Hans: 工作表 ID
|
||||
human_description:
|
||||
en_US: Sheet ID, either sheet_id or sheet_name must be filled.
|
||||
zh_Hans: 工作表 ID,与 sheet_name 二者其一必填。
|
||||
llm_description: 工作表 ID,与 sheet_name 二者其一必填。
|
||||
form: llm
|
||||
|
||||
- name: sheet_name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: sheet_name
|
||||
zh_Hans: 工作表名称
|
||||
human_description:
|
||||
en_US: Sheet name, either sheet_id or sheet_name must be filled.
|
||||
zh_Hans: 工作表名称,与 sheet_id 二者其一必填。
|
||||
llm_description: 工作表名称,与 sheet_id 二者其一必填。
|
||||
form: llm
|
||||
|
||||
- name: user_id_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: open_id
|
||||
label:
|
||||
en_US: open_id
|
||||
zh_Hans: open_id
|
||||
- value: union_id
|
||||
label:
|
||||
en_US: union_id
|
||||
zh_Hans: union_id
|
||||
- value: user_id
|
||||
label:
|
||||
en_US: user_id
|
||||
zh_Hans: user_id
|
||||
default: "open_id"
|
||||
label:
|
||||
en_US: user_id_type
|
||||
zh_Hans: 用户 ID 类型
|
||||
human_description:
|
||||
en_US: User ID type, optional values are open_id, union_id, user_id, with a default value of open_id.
|
||||
zh_Hans: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
llm_description: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
form: form
|
||||
|
||||
- name: start_row
|
||||
type: number
|
||||
required: false
|
||||
label:
|
||||
en_US: start_row
|
||||
zh_Hans: 起始行号
|
||||
human_description:
|
||||
en_US: Starting row number, starting from 1.
|
||||
zh_Hans: 起始行号,从 1 开始。
|
||||
llm_description: 起始行号,从 1 开始。
|
||||
form: form
|
||||
|
||||
- name: num_rows
|
||||
type: number
|
||||
required: true
|
||||
label:
|
||||
en_US: num_rows
|
||||
zh_Hans: 读取行数
|
||||
human_description:
|
||||
en_US: Number of rows to read.
|
||||
zh_Hans: 读取行数
|
||||
llm_description: 读取行数
|
||||
form: form
|
|
@ -0,0 +1,23 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class ReadTableTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
spreadsheet_token = tool_parameters.get("spreadsheet_token")
|
||||
sheet_id = tool_parameters.get("sheet_id")
|
||||
sheet_name = tool_parameters.get("sheet_name")
|
||||
num_range = tool_parameters.get("num_range")
|
||||
query = tool_parameters.get("query")
|
||||
user_id_type = tool_parameters.get("user_id_type", "open_id")
|
||||
|
||||
res = client.read_table(spreadsheet_token, sheet_id, sheet_name, num_range, query, user_id_type)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,122 @@
|
|||
identity:
|
||||
name: read_table
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Read Table
|
||||
zh_Hans: 自定义读取电子表格行列数据
|
||||
description:
|
||||
human:
|
||||
en_US: Read Table
|
||||
zh_Hans: 自定义读取电子表格行列数据
|
||||
llm: A tool for custom reading of row and column data from a spreadsheet. (自定义读取电子表格行列数据)
|
||||
parameters:
|
||||
- name: spreadsheet_token
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: spreadsheet_token
|
||||
zh_Hans: 电子表格 token
|
||||
human_description:
|
||||
en_US: Spreadsheet token, supports input of spreadsheet URL.
|
||||
zh_Hans: 电子表格 token,支持输入电子表格 url。
|
||||
llm_description: 电子表格 token,支持输入电子表格 url。
|
||||
form: llm
|
||||
|
||||
- name: sheet_id
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: sheet_id
|
||||
zh_Hans: 工作表 ID
|
||||
human_description:
|
||||
en_US: Sheet ID, either sheet_id or sheet_name must be filled.
|
||||
zh_Hans: 工作表 ID,与 sheet_name 二者其一必填。
|
||||
llm_description: 工作表 ID,与 sheet_name 二者其一必填。
|
||||
form: llm
|
||||
|
||||
- name: sheet_name
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: sheet_name
|
||||
zh_Hans: 工作表名称
|
||||
human_description:
|
||||
en_US: Sheet name, either sheet_id or sheet_name must be filled.
|
||||
zh_Hans: 工作表名称,与 sheet_id 二者其一必填。
|
||||
llm_description: 工作表名称,与 sheet_id 二者其一必填。
|
||||
form: llm
|
||||
|
||||
- name: user_id_type
|
||||
type: select
|
||||
required: false
|
||||
options:
|
||||
- value: open_id
|
||||
label:
|
||||
en_US: open_id
|
||||
zh_Hans: open_id
|
||||
- value: union_id
|
||||
label:
|
||||
en_US: union_id
|
||||
zh_Hans: union_id
|
||||
- value: user_id
|
||||
label:
|
||||
en_US: user_id
|
||||
zh_Hans: user_id
|
||||
default: "open_id"
|
||||
label:
|
||||
en_US: user_id_type
|
||||
zh_Hans: 用户 ID 类型
|
||||
human_description:
|
||||
en_US: User ID type, optional values are open_id, union_id, user_id, with a default value of open_id.
|
||||
zh_Hans: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
llm_description: 用户 ID 类型,可选值有 open_id、union_id、user_id,默认值为 open_id。
|
||||
form: form
|
||||
|
||||
- name: start_row
|
||||
type: number
|
||||
required: false
|
||||
label:
|
||||
en_US: start_row
|
||||
zh_Hans: 起始行号
|
||||
human_description:
|
||||
en_US: Starting row number, starting from 1.
|
||||
zh_Hans: 起始行号,从 1 开始。
|
||||
llm_description: 起始行号,从 1 开始。
|
||||
form: form
|
||||
|
||||
- name: num_rows
|
||||
type: number
|
||||
required: false
|
||||
label:
|
||||
en_US: num_rows
|
||||
zh_Hans: 读取行数
|
||||
human_description:
|
||||
en_US: Number of rows to read.
|
||||
zh_Hans: 读取行数
|
||||
llm_description: 读取行数
|
||||
form: form
|
||||
|
||||
- name: range
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: range
|
||||
zh_Hans: 取数范围
|
||||
human_description:
|
||||
en_US: |
|
||||
Data range, format like: A1:B2, can be empty when query=all.
|
||||
zh_Hans: 取数范围,格式如:A1:B2,query=all 时可为空。
|
||||
llm_description: 取数范围,格式如:A1:B2,query=all 时可为空。
|
||||
form: llm
|
||||
|
||||
- name: query
|
||||
type: string
|
||||
required: false
|
||||
label:
|
||||
en_US: query
|
||||
zh_Hans: 查询
|
||||
human_description:
|
||||
en_US: Pass "all" to query all data in the table, but no more than 100 columns.
|
||||
zh_Hans: 传 all,表示查询表格所有数据,但最多查询 100 列数据。
|
||||
llm_description: 传 all,表示查询表格所有数据,但最多查询 100 列数据。
|
||||
form: llm
|
BIN
api/core/tools/provider/builtin/lark_task/_assets/icon.png
Normal file
BIN
api/core/tools/provider/builtin/lark_task/_assets/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
7
api/core/tools/provider/builtin/lark_task/lark_task.py
Normal file
7
api/core/tools/provider/builtin/lark_task/lark_task.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController
|
||||
from core.tools.utils.lark_api_utils import lark_auth
|
||||
|
||||
|
||||
class LarkTaskProvider(BuiltinToolProviderController):
|
||||
def _validate_credentials(self, credentials: dict) -> None:
|
||||
lark_auth(credentials)
|
36
api/core/tools/provider/builtin/lark_task/lark_task.yaml
Normal file
36
api/core/tools/provider/builtin/lark_task/lark_task.yaml
Normal file
|
@ -0,0 +1,36 @@
|
|||
identity:
|
||||
author: Doug Lea
|
||||
name: lark_task
|
||||
label:
|
||||
en_US: Lark Task
|
||||
zh_Hans: Lark 任务
|
||||
description:
|
||||
en_US: |
|
||||
Lark Task, requires the following permissions: task:task:write、contact:user.id:readonly.
|
||||
zh_Hans: |
|
||||
Lark 任务,需要开通以下权限: task:task:write、contact:user.id:readonly。
|
||||
icon: icon.png
|
||||
tags:
|
||||
- social
|
||||
- productivity
|
||||
credentials_for_provider:
|
||||
app_id:
|
||||
type: text-input
|
||||
required: true
|
||||
label:
|
||||
en_US: APP ID
|
||||
placeholder:
|
||||
en_US: Please input your Lark app id
|
||||
zh_Hans: 请输入你的 Lark app id
|
||||
help:
|
||||
en_US: Get your app_id and app_secret from Lark
|
||||
zh_Hans: 从 Lark 获取您的 app_id 和 app_secret
|
||||
url: https://open.larksuite.com/app
|
||||
app_secret:
|
||||
type: secret-input
|
||||
required: true
|
||||
label:
|
||||
en_US: APP Secret
|
||||
placeholder:
|
||||
en_US: Please input your app secret
|
||||
zh_Hans: 请输入你的 Lark app secret
|
|
@ -0,0 +1,20 @@
|
|||
from typing import Any
|
||||
|
||||
from core.tools.entities.tool_entities import ToolInvokeMessage
|
||||
from core.tools.tool.builtin_tool import BuiltinTool
|
||||
from core.tools.utils.lark_api_utils import LarkRequest
|
||||
|
||||
|
||||
class AddMembersTool(BuiltinTool):
|
||||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage:
|
||||
app_id = self.runtime.credentials.get("app_id")
|
||||
app_secret = self.runtime.credentials.get("app_secret")
|
||||
client = LarkRequest(app_id, app_secret)
|
||||
|
||||
task_guid = tool_parameters.get("task_guid")
|
||||
member_phone_or_email = tool_parameters.get("member_phone_or_email")
|
||||
member_role = tool_parameters.get("member_role", "follower")
|
||||
|
||||
res = client.add_members(task_guid, member_phone_or_email, member_role)
|
||||
|
||||
return self.create_json_message(res)
|
|
@ -0,0 +1,58 @@
|
|||
identity:
|
||||
name: add_members
|
||||
author: Doug Lea
|
||||
label:
|
||||
en_US: Add Lark Members
|
||||
zh_Hans: 添加 Lark 任务成员
|
||||
description:
|
||||
human:
|
||||
en_US: Add Lark Members
|
||||
zh_Hans: 添加 Lark 任务成员
|
||||
llm: A tool for adding members to a Lark task.(添加 Lark 任务成员)
|
||||
parameters:
|
||||
- name: task_guid
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Task GUID
|
||||
zh_Hans: 任务 GUID
|
||||
human_description:
|
||||
en_US: |
|
||||
The GUID of the task to be added, supports passing either the Task ID or the Task link URL. Example of Task ID: 8b5425ec-9f2a-43bd-a3ab-01912f50282b; Example of Task link URL: https://applink.larksuite.com/client/todo/detail?guid=1b066afa-96de-406c-90a3-dfd30159a571&suite_entity_num=t100805
|
||||
zh_Hans: 要添加的任务的 GUID,支持传任务 ID 和任务链接 URL。任务 ID 示例:8b5425ec-9f2a-43bd-a3ab-01912f50282b;任务链接 URL 示例:https://applink.larksuite.com/client/todo/detail?guid=1b066afa-96de-406c-90a3-dfd30159a571&suite_entity_num=t100805
|
||||
llm_description: 要添加的任务的 GUID,支持传任务 ID 和任务链接 URL。任务 ID 示例:8b5425ec-9f2a-43bd-a3ab-01912f50282b;任务链接 URL 示例:https://applink.larksuite.com/client/todo/detail?guid=1b066afa-96de-406c-90a3-dfd30159a571&suite_entity_num=t100805
|
||||
form: llm
|
||||
|
||||
- name: member_phone_or_email
|
||||
type: string
|
||||
required: true
|
||||
label:
|
||||
en_US: Task Member Phone Or Email
|
||||
zh_Hans: 任务成员的电话或邮箱
|
||||
human_description:
|
||||
en_US: A list of member emails or phone numbers, separated by commas.
|
||||
zh_Hans: 任务成员邮箱或者手机号列表,使用逗号分隔。
|
||||
llm_description: 任务成员邮箱或者手机号列表,使用逗号分隔。
|
||||
form: llm
|
||||
|
||||
- name: member_role
|
||||
type: select
|
||||
required: true
|
||||
options:
|
||||
- value: assignee
|
||||
label:
|
||||
en_US: assignee
|
||||
zh_Hans: 负责人
|
||||
- value: follower
|
||||
label:
|
||||
en_US: follower
|
||||
zh_Hans: 关注人
|
||||
default: "follower"
|
||||
label:
|
||||
en_US: member_role
|
||||
zh_Hans: 成员的角色
|
||||
human_description:
|
||||
en_US: Member role, optional values are "assignee" (responsible person) and "follower" (observer), with a default value of "assignee".
|
||||
zh_Hans: 成员的角色,可选值有 "assignee"(负责人)和 "follower"(关注人),默认值为 "assignee"。
|
||||
llm_description: 成员的角色,可选值有 "assignee"(负责人)和 "follower"(关注人),默认值为 "assignee"。
|
||||
form: form
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user