方法参考(1) 本文说明 AIuse 云电脑 SDK 的主要对象、方法、参数和返回结构。 SDK 方法参考 Client 构造函数 plaintext new Client(options: ClientOptions): Client ClientOptions 参数: 参数名 类型 是否必填 说明 apiKey string 是 控制台创建的 AccessKey ID apiSecret string 是 控制台创建的 AccessKey Secret desktopCode string 是 云电脑桌面编码 serviceURL string 否 服务地址,默认值以 SDK 发布版本为准 示例: plaintext import Client from '@ctyun/desktopagentsdk'; const client new Client({ apiKey: process.env.AIUSEAPIKEY, apiSecret: process.env.AIUSEAPISECRET, desktopCode: process.env.AIUSEDESKTOPCODE, serviceURL: process.env.AIUSESERVICEURL ' }); createSession 创建会话并返回会话对象。 plaintext async createSession(): Promise 返回的 Session 对象包含: 属性名 类型 说明 sessionId string 会话唯一标识 computer ComputerAPI Computer Use 方法集合 filesystem FileSystemAPI FileSystem 方法集合 close Function 关闭会话方法 通用返回结构 SDK 方法通常返回如下结构: plaintext { "code": 0, "data": null, "msg": null } 字段 类型 说明 code number 状态码,0 通常表示成功 data any 成功时的业务结果 msg string 失败时的错误信息 ComputerAPI movemouse 移动鼠标到指定坐标。 plaintext await session.computer.movemouse({ x: 500, y: 300 }); 参数 类型 是否必填 说明 x number 是 目标 X 坐标 y number 是 目标 Y 坐标
来自: