@ray-js/t-agent-plugin-aistream 0.2.5 → 0.2.6-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/AIStreamTypes.d.ts
CHANGED
|
@@ -614,7 +614,9 @@ export declare enum ConnectClientType {
|
|
|
614
614
|
/** 作为设备代理 */
|
|
615
615
|
DEVICE = 1,
|
|
616
616
|
/** 作为 App */
|
|
617
|
-
APP = 2
|
|
617
|
+
APP = 2,
|
|
618
|
+
/** 作为开发者(行业 APP) */
|
|
619
|
+
DEVELOPER = 3
|
|
618
620
|
}
|
|
619
621
|
export declare enum EventType {
|
|
620
622
|
/** 事件开始 */
|
|
@@ -1101,13 +1103,13 @@ export type ConnectParams = {
|
|
|
1101
1103
|
*/
|
|
1102
1104
|
export type QueryAgentTokenParams = {
|
|
1103
1105
|
/** Owner ID: HomeID 或 设备id */
|
|
1104
|
-
ownerId
|
|
1106
|
+
ownerId?: string;
|
|
1105
1107
|
/** 智能解决方案 code */
|
|
1106
1108
|
solutionCode: string;
|
|
1107
1109
|
/** 业务接口 */
|
|
1108
1110
|
api: string;
|
|
1109
1111
|
/** 接口版本 */
|
|
1110
|
-
apiVersion
|
|
1112
|
+
apiVersion?: string;
|
|
1111
1113
|
/** 业务额外参数 */
|
|
1112
1114
|
extParams: any;
|
|
1113
1115
|
success?: (params: {
|
package/dist/AIStreamTypes.js
CHANGED
|
@@ -90,6 +90,7 @@ export let SessionState = /*#__PURE__*/function (SessionState) {
|
|
|
90
90
|
export let ConnectClientType = /*#__PURE__*/function (ConnectClientType) {
|
|
91
91
|
ConnectClientType[ConnectClientType["DEVICE"] = 1] = "DEVICE";
|
|
92
92
|
ConnectClientType[ConnectClientType["APP"] = 2] = "APP";
|
|
93
|
+
ConnectClientType[ConnectClientType["DEVELOPER"] = 3] = "DEVELOPER";
|
|
93
94
|
return ConnectClientType;
|
|
94
95
|
}({});
|
|
95
96
|
export let EventType = /*#__PURE__*/function (EventType) {
|
package/dist/utils/AIStream.d.ts
CHANGED
package/dist/utils/AIStream.js
CHANGED
|
@@ -221,7 +221,10 @@ export class AIStreamSession {
|
|
|
221
221
|
throw e;
|
|
222
222
|
}
|
|
223
223
|
let ownerId = this.options.ownerId;
|
|
224
|
-
if (
|
|
224
|
+
if (this.connection.options.clientType === ConnectClientType.DEVELOPER) {
|
|
225
|
+
ownerId = undefined;
|
|
226
|
+
this.options.ownerId = undefined;
|
|
227
|
+
} else if (!ownerId) {
|
|
225
228
|
if (this.connection.options.clientType === ConnectClientType.APP) {
|
|
226
229
|
try {
|
|
227
230
|
const {
|
package/dist/withAIStream.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { TTTAction } from './utils';
|
|
|
3
3
|
import { ConnectClientType, ReceivedTextSkillPacketBody } from './AIStreamTypes';
|
|
4
4
|
import { ChatHistoryStore, StoredMessageObject } from './ChatHistoryStore';
|
|
5
5
|
export interface AIStreamOptions {
|
|
6
|
-
/** client 类型: 1-作为设备代理, 2-作为 App */
|
|
6
|
+
/** client 类型: 1-作为设备代理, 2-作为 App,3-作为开发者(行业 App) */
|
|
7
7
|
clientType?: ConnectClientType;
|
|
8
8
|
/** 代理的设备ID, clientType == 1 时必传 */
|
|
9
9
|
deviceId?: string;
|
|
@@ -12,7 +12,8 @@ export interface AIStreamOptions {
|
|
|
12
12
|
/** 获取 agent token 的参数 */
|
|
13
13
|
tokenOptions?: {
|
|
14
14
|
api: string;
|
|
15
|
-
|
|
15
|
+
/** 如果是 clientType == 3,则是 highway 接口,可以不传 */
|
|
16
|
+
version?: string;
|
|
16
17
|
extParams?: Record<string, any>;
|
|
17
18
|
};
|
|
18
19
|
/** 历史消息数量,默认1000,为0的话,则已分页的方式取全部数据 */
|
package/dist/withAIStream.js
CHANGED
|
@@ -47,7 +47,11 @@ export function withAIStream() {
|
|
|
47
47
|
if (!agentId) {
|
|
48
48
|
throw new Error('agentId is required');
|
|
49
49
|
}
|
|
50
|
-
if (
|
|
50
|
+
if (clientType === ConnectClientType.DEVELOPER) {
|
|
51
|
+
if (!tokenOptions.api) {
|
|
52
|
+
throw new Error('tokenOptions.api is required');
|
|
53
|
+
}
|
|
54
|
+
} else if (!tokenOptions.api || !tokenOptions.version) {
|
|
51
55
|
throw new Error('tokenOptions.api and tokenOptions.version are required');
|
|
52
56
|
}
|
|
53
57
|
if (clientType === ConnectClientType.DEVICE && !deviceId) {
|
|
@@ -57,6 +61,9 @@ export function withAIStream() {
|
|
|
57
61
|
throw new Error('deviceId is not allowed when clientType is app');
|
|
58
62
|
}
|
|
59
63
|
let homeId = options.homeId;
|
|
64
|
+
if (clientType === ConnectClientType.DEVELOPER) {
|
|
65
|
+
homeId = 1;
|
|
66
|
+
}
|
|
60
67
|
if (!homeId) {
|
|
61
68
|
const info = await getCurrentHomeInfo();
|
|
62
69
|
homeId = +info.homeId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/t-agent-plugin-aistream",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6-beta-1",
|
|
4
4
|
"author": "Tuya.inc",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/url-parse": "^1.4.11"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "7c5c58dfe2f598e502f3a9a09ed2439660336ce3"
|
|
39
39
|
}
|