@ray-js/t-agent 0.0.9-beta-4 → 0.1.0-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/README-zh_CN.md CHANGED
@@ -951,6 +951,8 @@ const send = async () => {
951
951
 
952
952
  弹窗提醒用户接受 AI 隐私协议,安全要求,在 App 里需要用户同意协议后才能使用 AI 功能
953
953
 
954
+ > 注意,这个函数要求 `BaseKit >=3.20.4`,如果你的 BaseKit 版本低于这个版本,会直接放行
955
+
954
956
  ```tsx
955
957
  import { authorizeAssistantPolicy } from '@ray-js/t-agent-plugin-assistant';
956
958
 
@@ -1403,4 +1405,4 @@ const renderOptions = {
1403
1405
  | t-agent.input.voice.require-permission | MessageInput 切换语音输入 | 需要授权录音权限 |
1404
1406
  | t-agent.input.upload.failed | MessageInput 上传文件 | 文件上传失败 |
1405
1407
  | t-agent.message.feedback.success | BubbleTile 消息评价 | 反馈成功 |
1406
- | t-agent-bubble-tile-aborted | BubbleTile 消息 | 用户中断 |
1408
+ | t-agent.message.bubble.aborted | BubbleTile 消息 | 用户中断 |
package/README.md CHANGED
@@ -946,6 +946,8 @@ const send = async () => {
946
946
 
947
947
  Popup to remind users to accept the AI privacy policy, a security requirement that users must agree to access AI features in the app
948
948
 
949
+ > Note that this function requires `BaseKit >= 3.20.4`. If your BaseKit version is lower than this version, it will be directly passed.
950
+
949
951
  ```tsx
950
952
  import { authorizeAssistantPolicy } from '@ray-js/t-agent-plugin-assistant';
951
953
 
@@ -1398,4 +1400,4 @@ Below are the built-in multilingual keys:
1398
1400
  | t-agent.input.voice.require-permission | MessageInput switch to voice input | Need to grant recording permission |
1399
1401
  | t-agent.input.upload.failed | MessageInput file upload | File upload failed |
1400
1402
  | t-agent.message.feedback.success | BubbleTile message feedback | Feedback successful |
1401
- | t-agent-bubble-tile-aborted | BubbleTile message | User aborted |
1403
+ | t-agent.message.bubble.aborted | BubbleTile message | User aborted |
@@ -145,6 +145,11 @@ export default class ChatAgent<P extends Record<string, unknown> = Record<string
145
145
  * @param messageId message id
146
146
  */
147
147
  removeMessage: (messageId: string) => Promise<void>;
148
+ /**
149
+ * 按channel删除消息
150
+ * @param channel
151
+ */
152
+ removeMessageByChannel: (channel: string) => void;
148
153
  /**
149
154
  * Start a stream to show the response from the StreamResponseInstance, which will trigger the onMessageUpdate hook
150
155
  *
@@ -5,6 +5,8 @@ const _excluded = ["hooks"];
5
5
  import "core-js/modules/es.symbol.description.js";
6
6
  import "core-js/modules/es.symbol.async-iterator.js";
7
7
  import "core-js/modules/es.promise.finally.js";
8
+ import "core-js/modules/esnext.iterator.constructor.js";
9
+ import "core-js/modules/esnext.iterator.for-each.js";
8
10
  import "core-js/modules/web.dom-collections.iterator.js";
9
11
  function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
10
12
  function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function (r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function () { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function (r) { var n = this.s.return; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, throw: function (r) { var n = this.s.return; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
@@ -172,6 +174,24 @@ export default class ChatAgent {
172
174
  await message.remove();
173
175
  });
174
176
  });
177
+ /**
178
+ * 按channel删除消息
179
+ * @param channel
180
+ */
181
+ _defineProperty(this, "removeMessageByChannel", channel => {
182
+ this.runWithCatchError(async () => {
183
+ try {
184
+ const assistant = this.plugins.assistant;
185
+ if (assistant !== null && assistant !== void 0 && assistant.removeMessageByChannel) {
186
+ await assistant.removeMessageByChannel(channel);
187
+ } else {
188
+ this.session.messages.values().forEach(message => message.remove());
189
+ }
190
+ } catch (error) {
191
+ this.session.messages.values().forEach(message => message.remove());
192
+ }
193
+ });
194
+ });
175
195
  /**
176
196
  * Start a stream to show the response from the StreamResponseInstance, which will trigger the onMessageUpdate hook
177
197
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/t-agent",
3
- "version": "0.0.9-beta-4",
3
+ "version": "0.1.0-beta-1",
4
4
  "author": "Tuya.inc",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -26,5 +26,5 @@
26
26
  "build": "ray build --type=component --output dist",
27
27
  "clean": "rimraf ./dist"
28
28
  },
29
- "gitHead": "328a8616b0356cbaef02d7a4ad46ee0c077d04be"
29
+ "gitHead": "4d28a9d910b523c6b133c32041290fd5967ce116"
30
30
  }