@agentscope-ai/chat 1.1.19 → 1.1.20-beta.1763624675719

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.
@@ -8,10 +8,13 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
8
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
10
  import React, { useMemo } from 'react';
11
- import { useCustomCardsContext } from "./..";
11
+ import { useChatAnywhere, useCustomCardsContext } from "./..";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  var Card = /*#__PURE__*/React.memo(function (props) {
14
14
  var cardConfig = useCustomCardsContext();
15
+ var onInput = useChatAnywhere(function (v) {
16
+ return v.onInput;
17
+ });
15
18
  var Component = useMemo(function () {
16
19
  if (props.component) return props.component;
17
20
  var cardConfigMap = cardConfig;
@@ -22,7 +25,11 @@ var Card = /*#__PURE__*/React.memo(function (props) {
22
25
  if (typeof Component === 'function') {
23
26
  var component = props.component,
24
27
  rest = _objectWithoutProperties(props, _excluded);
25
- return /*#__PURE__*/_jsx(Component, _objectSpread({}, rest));
28
+ return /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread({}, rest), {}, {
29
+ context: {
30
+ onInput: onInput
31
+ }
32
+ }));
26
33
  } else {
27
34
  return Component;
28
35
  }
@@ -35,6 +35,24 @@ var Null = function Null() {
35
35
  var EMPTY_DOMPURIFY_CONFIG = {
36
36
  ALLOWED_TAGS: []
37
37
  };
38
+
39
+ /**
40
+ * 检测浏览器是否支持正则表达式的 lookbehind assertions
41
+ * iOS Safari < 16.4 不支持此特性
42
+ */
43
+ function supportsLookbehindAssertions() {
44
+ try {
45
+ // 尝试创建包含正向后行断言的正则表达式
46
+ new RegExp('(?<=a)b');
47
+ return true;
48
+ } catch (e) {
49
+ return false;
50
+ }
51
+ }
52
+ var isSupportsLookbehindAssertions = supportsLookbehindAssertions();
53
+ console.log({
54
+ isSupportsLookbehindAssertions: isSupportsLookbehindAssertions
55
+ });
38
56
  export default /*#__PURE__*/memo(function (props) {
39
57
  var baseFontSize = props.baseFontSize || 14;
40
58
  var baseLineHeight = props.baseLineHeight || 1.7;
@@ -68,7 +86,7 @@ export default /*#__PURE__*/memo(function (props) {
68
86
  citationsData = _useCitationsData.citationsData,
69
87
  citationsDataCount = _useCitationsData.citationsDataCount,
70
88
  CitationComponent = _useCitationsData.CitationComponent;
71
- if (props.raw) return /*#__PURE__*/_jsx("div", {
89
+ if (props.raw || !isSupportsLookbehindAssertions) return /*#__PURE__*/_jsx("div", {
72
90
  className: prefixCls,
73
91
  style: {
74
92
  fontSize: baseFontSize,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentscope-ai/chat",
3
- "version": "1.1.19",
3
+ "version": "1.1.20-beta.1763624675719",
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": [