@agentscope-ai/chat 1.1.45-beta.1766392979633 → 1.1.45-beta.1766406069468

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.
@@ -33,6 +33,8 @@ export default function Tools(props: {
33
33
  }
34
34
  ];
35
35
 
36
+ const replace = useChatAnywhereOptions(v => v.actions?.replace) ?? true;
37
+
36
38
  const actions = compact([
37
39
  ...actionsOptionsList.map(i => {
38
40
  const res = i;
@@ -46,7 +48,7 @@ export default function Tools(props: {
46
48
  }
47
49
  }
48
50
  }),
49
- props.isLast ? {
51
+ replace && props.isLast ? {
50
52
  icon: <Tooltip title="重新生成"><SparkReplaceLine /></Tooltip>,
51
53
  onClick: () => {
52
54
  emit({
@@ -345,6 +345,12 @@ export interface IAgentScopeRuntimeWebUIActionsOptions {
345
345
  }) => React.ReactElement;
346
346
  onClick?: ({ data }: { data: IAgentScopeRuntimeResponse }) => void;
347
347
  }[];
348
+
349
+ /**
350
+ * @description 是否显示重新生成按钮
351
+ * @descriptionEn Whether to show the replace button
352
+ */
353
+ replace?: boolean;
348
354
  }
349
355
 
350
356
  /**
@@ -96,7 +96,7 @@ export default forwardRef(function (_, ref) {
96
96
 
97
97
  if (item.trigger) {
98
98
  trigger = item.trigger;
99
- } else if (item.title || item.description) {
99
+ } else if ((item.title || item.description) && onUpload.length > 1) {
100
100
  trigger = <Button type='text' icon={item.icon} >
101
101
  {item.title && <span>{item.title}</span>}
102
102
  {item.description && <span style={{ fontSize: '0.8em', opacity: 0.8 }}>{item.description}</span>}
@@ -26,7 +26,7 @@ function Usage(props) {
26
26
  });
27
27
  }
28
28
  export default function Tools(props) {
29
- var _props$data$usage, _props$data$usage2;
29
+ var _useChatAnywhereOptio, _props$data$usage, _props$data$usage2;
30
30
  var actionsOptionsList = useChatAnywhereOptions(function (v) {
31
31
  var _v$actions;
32
32
  return (_v$actions = v.actions) === null || _v$actions === void 0 ? void 0 : _v$actions.list;
@@ -36,6 +36,10 @@ export default function Tools(props) {
36
36
  copy(JSON.stringify(props.data));
37
37
  }
38
38
  }];
39
+ var replace = (_useChatAnywhereOptio = useChatAnywhereOptions(function (v) {
40
+ var _v$actions2;
41
+ return (_v$actions2 = v.actions) === null || _v$actions2 === void 0 ? void 0 : _v$actions2.replace;
42
+ })) !== null && _useChatAnywhereOptio !== void 0 ? _useChatAnywhereOptio : true;
39
43
  var actions = compact([].concat(_toConsumableArray(actionsOptionsList.map(function (i) {
40
44
  var res = i;
41
45
  if (i.render) {
@@ -49,7 +53,7 @@ export default function Tools(props) {
49
53
  (_i$onClick = i.onClick) === null || _i$onClick === void 0 || _i$onClick.call(i, props);
50
54
  }
51
55
  });
52
- })), [props.isLast ? {
56
+ })), [replace && props.isLast ? {
53
57
  icon: /*#__PURE__*/_jsx(Tooltip, {
54
58
  title: "\u91CD\u65B0\u751F\u6210",
55
59
  children: /*#__PURE__*/_jsx(SparkReplaceLine, {})
@@ -332,6 +332,11 @@ export interface IAgentScopeRuntimeWebUIActionsOptions {
332
332
  data: IAgentScopeRuntimeResponse;
333
333
  }) => void;
334
334
  }[];
335
+ /**
336
+ * @description 是否显示重新生成按钮
337
+ * @descriptionEn Whether to show the replace button
338
+ */
339
+ replace?: boolean;
335
340
  }
336
341
  /**
337
342
  * @description 输入框上下文状态接口
@@ -132,7 +132,7 @@ export default /*#__PURE__*/forwardRef(function (_, ref) {
132
132
  var trigger;
133
133
  if (item.trigger) {
134
134
  trigger = item.trigger;
135
- } else if (item.title || item.description) {
135
+ } else if ((item.title || item.description) && onUpload.length > 1) {
136
136
  trigger = /*#__PURE__*/_jsxs(Button, {
137
137
  type: "text",
138
138
  icon: item.icon,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentscope-ai/chat",
3
- "version": "1.1.45-beta.1766392979633",
3
+ "version": "1.1.45-beta.1766406069468",
4
4
  "description": "a free and open-source chat framework for building excellent LLM-powered chat experiences",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": [