@difizen/libro-prompt-cell 0.1.13 → 0.1.15
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.md +7 -0
- package/es/index.less +6 -0
- package/es/input-handler/chat-record-input.d.ts +12 -0
- package/es/input-handler/chat-record-input.d.ts.map +1 -0
- package/es/input-handler/chat-record-input.js +92 -0
- package/es/input-handler/index.d.ts +3 -0
- package/es/input-handler/index.d.ts.map +1 -0
- package/es/input-handler/index.js +2 -0
- package/es/input-handler/index.less +91 -0
- package/es/input-handler/variable-name-input.d.ts +18 -0
- package/es/input-handler/variable-name-input.d.ts.map +1 -0
- package/es/input-handler/variable-name-input.js +120 -0
- package/es/libro-formatter-prompt-magic-contribution.d.ts +9 -0
- package/es/libro-formatter-prompt-magic-contribution.d.ts.map +1 -1
- package/es/libro-formatter-prompt-magic-contribution.js +12 -3
- package/es/module.js +2 -2
- package/es/prompt-cell-model.d.ts +16 -0
- package/es/prompt-cell-model.d.ts.map +1 -1
- package/es/prompt-cell-model.js +49 -13
- package/es/prompt-cell-script.d.ts +3 -2
- package/es/prompt-cell-script.d.ts.map +1 -1
- package/es/prompt-cell-script.js +13 -4
- package/es/prompt-cell-view.d.ts +33 -13
- package/es/prompt-cell-view.d.ts.map +1 -1
- package/es/prompt-cell-view.js +326 -181
- package/es/prompt-output-render.js +15 -16
- package/package.json +11 -7
- package/src/index.less +6 -0
- package/src/input-handler/chat-record-input.tsx +93 -0
- package/src/input-handler/index.less +91 -0
- package/src/input-handler/index.ts +2 -0
- package/src/input-handler/variable-name-input.tsx +121 -0
- package/src/libro-formatter-prompt-magic-contribution.ts +13 -2
- package/src/module.ts +2 -2
- package/src/prompt-cell-model.ts +26 -0
- package/src/prompt-cell-script.ts +8 -3
- package/src/prompt-cell-view.tsx +233 -92
- package/src/prompt-output-render.tsx +1 -1
- package/es/prompt-cell-output-area.d.ts +0 -14
- package/es/prompt-cell-output-area.d.ts.map +0 -1
- package/es/prompt-cell-output-area.js +0 -74
- package/src/prompt-cell-output-area.tsx +0 -59
package/README.md
CHANGED
package/es/index.less
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
interface ChatRecordInputProps {
|
|
4
|
+
value: string;
|
|
5
|
+
handleChange: (value: string) => void;
|
|
6
|
+
onFocus?: () => void;
|
|
7
|
+
classname?: string;
|
|
8
|
+
records: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare const ChatRecordInput: FC<ChatRecordInputProps>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=chat-record-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-record-input.d.ts","sourceRoot":"","sources":["../../src/input-handler/chat-record-input.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO,cAAc,CAAC;AAEtB,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAwEpD,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { EditFilled } from '@ant-design/icons';
|
|
8
|
+
import { LirboContextKey } from '@difizen/libro-core';
|
|
9
|
+
import { useInject } from '@difizen/mana-app';
|
|
10
|
+
import { Select, Tag } from 'antd';
|
|
11
|
+
import classNames from 'classnames';
|
|
12
|
+
import { useEffect } from 'react';
|
|
13
|
+
import { useRef } from 'react';
|
|
14
|
+
import { useState } from 'react';
|
|
15
|
+
import "./index.less";
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
var ChatRecordInputCls = 'libro-chat-record-input';
|
|
20
|
+
export var ChatRecordInput = function ChatRecordInput(props) {
|
|
21
|
+
var value = props.value,
|
|
22
|
+
records = props.records,
|
|
23
|
+
handleChange = props.handleChange,
|
|
24
|
+
_onFocus = props.onFocus;
|
|
25
|
+
var selectRef = useRef(null);
|
|
26
|
+
var _useState = useState(false),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
selecting = _useState2[0],
|
|
29
|
+
setSelecting = _useState2[1];
|
|
30
|
+
var ref = useRef(null);
|
|
31
|
+
var contextKey = useInject(LirboContextKey);
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
if (selecting) {
|
|
34
|
+
var _selectRef$current;
|
|
35
|
+
(_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 || _selectRef$current.focus();
|
|
36
|
+
}
|
|
37
|
+
}, [selecting]);
|
|
38
|
+
var handleSelecting = function handleSelecting(value) {
|
|
39
|
+
if (value) {
|
|
40
|
+
contextKey.disableCommandMode();
|
|
41
|
+
} else {
|
|
42
|
+
contextKey.enableCommandMode();
|
|
43
|
+
}
|
|
44
|
+
setSelecting(value);
|
|
45
|
+
};
|
|
46
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
47
|
+
className: classNames(ChatRecordInputCls, props.classname),
|
|
48
|
+
ref: ref,
|
|
49
|
+
tabIndex: 0,
|
|
50
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
51
|
+
className: "libro-chat-record-input-label",
|
|
52
|
+
children: "Chat: "
|
|
53
|
+
}), selecting ? /*#__PURE__*/_jsx(Select, {
|
|
54
|
+
ref: selectRef,
|
|
55
|
+
className: "libro-chat-record-input-select",
|
|
56
|
+
size: "small",
|
|
57
|
+
mode: "tags",
|
|
58
|
+
style: {
|
|
59
|
+
width: '100%'
|
|
60
|
+
},
|
|
61
|
+
placeholder: "\u9009\u62E9\u6216\u8F93\u5165\u804A\u5929\u6807\u8BC6",
|
|
62
|
+
onSelect: handleChange,
|
|
63
|
+
showSearch: false,
|
|
64
|
+
onBlur: function onBlur() {
|
|
65
|
+
handleSelecting(false);
|
|
66
|
+
},
|
|
67
|
+
onFocus: function onFocus() {
|
|
68
|
+
if (_onFocus) {
|
|
69
|
+
_onFocus();
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
options: records.map(function (record) {
|
|
73
|
+
return {
|
|
74
|
+
label: record,
|
|
75
|
+
value: record
|
|
76
|
+
};
|
|
77
|
+
}) || []
|
|
78
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
79
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
80
|
+
className: "libro-chat-record-input-value",
|
|
81
|
+
children: value ? /*#__PURE__*/_jsx(Tag, {
|
|
82
|
+
children: value
|
|
83
|
+
}) : '...'
|
|
84
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
85
|
+
onClick: function onClick() {
|
|
86
|
+
handleSelecting(true);
|
|
87
|
+
},
|
|
88
|
+
children: /*#__PURE__*/_jsx(EditFilled, {})
|
|
89
|
+
})]
|
|
90
|
+
})]
|
|
91
|
+
});
|
|
92
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/input-handler/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
.libro-chat-record-input {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
padding: 0 8px;
|
|
5
|
+
|
|
6
|
+
&-select {
|
|
7
|
+
min-width: 180px;
|
|
8
|
+
padding: 0 8px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&-value {
|
|
12
|
+
padding-left: 2px;
|
|
13
|
+
|
|
14
|
+
span {
|
|
15
|
+
margin-inline-end: 0;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&-label {
|
|
20
|
+
padding-left: 16px;
|
|
21
|
+
color: var(--mana-libro-cell-header-title);
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
letter-spacing: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
svg {
|
|
27
|
+
margin-left: 4px;
|
|
28
|
+
color: #bdc0c4 !important;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
|
|
31
|
+
&:hover {
|
|
32
|
+
color: #1590ff !important;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.libro-variable-name-input {
|
|
38
|
+
border-left: 1px solid var(--mana-color-border);
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
|
|
42
|
+
svg {
|
|
43
|
+
margin-left: 4px;
|
|
44
|
+
color: #bdc0c4 !important;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
|
|
47
|
+
&:hover {
|
|
48
|
+
color: #1590ff !important;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&-value {
|
|
53
|
+
padding-left: 2px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&-label {
|
|
57
|
+
padding-left: 16px;
|
|
58
|
+
color: var(--mana-libro-cell-header-title);
|
|
59
|
+
font-size: 14px;
|
|
60
|
+
letter-spacing: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&-input {
|
|
64
|
+
width: 120px;
|
|
65
|
+
height: 32px;
|
|
66
|
+
border: 1px solid #d6d8da;
|
|
67
|
+
border-radius: 6px;
|
|
68
|
+
box-shadow: unset;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&-popover {
|
|
72
|
+
vertical-align: middle;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&-warning-text {
|
|
76
|
+
margin-top: 4px;
|
|
77
|
+
color: #faad14;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&-actions {
|
|
81
|
+
padding: 2px 0;
|
|
82
|
+
|
|
83
|
+
span + span {
|
|
84
|
+
margin-left: 8px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
span {
|
|
88
|
+
color: #1890ff;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
interface VariableNameInputPopoverContentProps {
|
|
4
|
+
value: string;
|
|
5
|
+
handleVariableNameChange: (variableName: string) => void;
|
|
6
|
+
checkVariableNameAvailable: (variableName: string) => boolean;
|
|
7
|
+
cancel: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const VariableNameInputPopoverContent: FC<VariableNameInputPopoverContentProps>;
|
|
10
|
+
interface VariableNameInputProps {
|
|
11
|
+
value: string;
|
|
12
|
+
handleVariableNameChange: (variableName: string) => void;
|
|
13
|
+
checkVariableNameAvailable: (variableName: string) => boolean;
|
|
14
|
+
classname?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const VariableNameInput: FC<VariableNameInputProps>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=variable-name-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variable-name-input.d.ts","sourceRoot":"","sources":["../../src/input-handler/variable-name-input.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO,cAAc,CAAC;AAEtB,UAAU,oCAAoC;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,wBAAwB,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,0BAA0B,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9D,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,+BAA+B,EAAE,EAAE,CAC9C,oCAAoC,CAgDrC,CAAC;AAEF,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,wBAAwB,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,0BAA0B,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CA2CxD,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { EditFilled } from '@ant-design/icons';
|
|
14
|
+
import { LirboContextKey } from '@difizen/libro-core';
|
|
15
|
+
import { useInject } from '@difizen/mana-app';
|
|
16
|
+
import { l10n } from '@difizen/mana-l10n';
|
|
17
|
+
import { Input, Popover } from 'antd';
|
|
18
|
+
import classNames from 'classnames';
|
|
19
|
+
import { useEffect } from 'react';
|
|
20
|
+
import { useRef } from 'react';
|
|
21
|
+
import { useCallback, useState } from 'react';
|
|
22
|
+
import "./index.less";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
26
|
+
export var VariableNameInputPopoverContent = function VariableNameInputPopoverContent(props) {
|
|
27
|
+
var value = props.value,
|
|
28
|
+
handleVariableNameChange = props.handleVariableNameChange,
|
|
29
|
+
checkVariableNameAvailable = props.checkVariableNameAvailable,
|
|
30
|
+
cancel = props.cancel;
|
|
31
|
+
var _useState = useState(true),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
variableNameAvailable = _useState2[0],
|
|
34
|
+
setVariableNameAvailable = _useState2[1];
|
|
35
|
+
var _useState3 = useState(value),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
variableName = _useState4[0],
|
|
38
|
+
setVariableName = _useState4[1];
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
setVariableName(value);
|
|
41
|
+
}, [value]);
|
|
42
|
+
var handleValueChange = useCallback(function (e) {
|
|
43
|
+
if (checkVariableNameAvailable(e.target.value)) {
|
|
44
|
+
setVariableNameAvailable(false);
|
|
45
|
+
} else {
|
|
46
|
+
setVariableNameAvailable(true);
|
|
47
|
+
}
|
|
48
|
+
setVariableName(e.target.value);
|
|
49
|
+
}, [checkVariableNameAvailable]);
|
|
50
|
+
var handValueSave = useCallback(function () {
|
|
51
|
+
handleVariableNameChange(variableName);
|
|
52
|
+
cancel();
|
|
53
|
+
}, [variableName, handleVariableNameChange, cancel]);
|
|
54
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
55
|
+
children: [/*#__PURE__*/_jsx(Input, {
|
|
56
|
+
status: "".concat(variableNameAvailable ? '' : 'warning'),
|
|
57
|
+
className: "libro-variable-name-input-component",
|
|
58
|
+
onChange: handleValueChange,
|
|
59
|
+
value: variableName
|
|
60
|
+
}), !variableNameAvailable && /*#__PURE__*/_jsx("span", {
|
|
61
|
+
className: "libro-variable-name-input-warning-text",
|
|
62
|
+
children: l10n.t('当前变量名已存在')
|
|
63
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
64
|
+
className: "libro-variable-name-input-actions",
|
|
65
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
66
|
+
onClick: cancel,
|
|
67
|
+
children: l10n.t('取消')
|
|
68
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
69
|
+
onClick: handValueSave,
|
|
70
|
+
children: l10n.t('保存')
|
|
71
|
+
})]
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
var variableNameInputCls = 'libro-variable-name-input';
|
|
76
|
+
export var VariableNameInput = function VariableNameInput(props) {
|
|
77
|
+
var value = props.value;
|
|
78
|
+
var _useState5 = useState(false),
|
|
79
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
80
|
+
popoverVisible = _useState6[0],
|
|
81
|
+
setPopoverVisible = _useState6[1];
|
|
82
|
+
var contextKey = useInject(LirboContextKey);
|
|
83
|
+
var ref = useRef(null);
|
|
84
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
85
|
+
className: classNames(variableNameInputCls, props.classname),
|
|
86
|
+
ref: ref,
|
|
87
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
88
|
+
className: "libro-variable-name-input-label",
|
|
89
|
+
children: "Save: "
|
|
90
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
91
|
+
className: "libro-variable-name-input-value",
|
|
92
|
+
children: value || '...'
|
|
93
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
94
|
+
className: "libro-variable-name-input-popover",
|
|
95
|
+
children: /*#__PURE__*/_jsx(Popover, {
|
|
96
|
+
content: /*#__PURE__*/_jsx(VariableNameInputPopoverContent, _objectSpread(_objectSpread({}, props), {}, {
|
|
97
|
+
cancel: function cancel() {
|
|
98
|
+
setPopoverVisible(false);
|
|
99
|
+
}
|
|
100
|
+
})),
|
|
101
|
+
placement: "bottomLeft",
|
|
102
|
+
open: popoverVisible,
|
|
103
|
+
onOpenChange: function onOpenChange(visible) {
|
|
104
|
+
if (visible) {
|
|
105
|
+
contextKey.disableCommandMode();
|
|
106
|
+
} else {
|
|
107
|
+
contextKey.enableCommandMode();
|
|
108
|
+
}
|
|
109
|
+
setPopoverVisible(visible);
|
|
110
|
+
},
|
|
111
|
+
getPopupContainer: function getPopupContainer() {
|
|
112
|
+
var _ref$current;
|
|
113
|
+
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getElementsByClassName(variableNameInputCls)[0];
|
|
114
|
+
},
|
|
115
|
+
trigger: "click",
|
|
116
|
+
children: /*#__PURE__*/_jsx(EditFilled, {})
|
|
117
|
+
})
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
120
|
+
};
|
|
@@ -2,6 +2,9 @@ import type { DefaultEncodedFormatter } from '@difizen/libro-jupyter';
|
|
|
2
2
|
import { DefaultDecodedFormatter, FormatterContribution } from '@difizen/libro-jupyter';
|
|
3
3
|
export interface PromptDecodedFormatter extends DefaultDecodedFormatter {
|
|
4
4
|
modelType?: string;
|
|
5
|
+
variableName?: string;
|
|
6
|
+
cellId?: string;
|
|
7
|
+
record?: string;
|
|
5
8
|
}
|
|
6
9
|
export declare class FormatterPromptMagicContribution implements FormatterContribution<PromptDecodedFormatter> {
|
|
7
10
|
formatter: string;
|
|
@@ -15,10 +18,16 @@ export declare class FormatterPromptMagicContribution implements FormatterContri
|
|
|
15
18
|
};
|
|
16
19
|
decode: (formatterValue: DefaultEncodedFormatter) => {
|
|
17
20
|
value: any;
|
|
21
|
+
variableName: any;
|
|
18
22
|
modelType: any;
|
|
23
|
+
cellId: any;
|
|
24
|
+
record: any;
|
|
19
25
|
} | {
|
|
20
26
|
value: string;
|
|
27
|
+
variableName?: undefined;
|
|
21
28
|
modelType?: undefined;
|
|
29
|
+
cellId?: undefined;
|
|
30
|
+
record?: undefined;
|
|
22
31
|
};
|
|
23
32
|
validate: (source: PromptDecodedFormatter) => source is PromptDecodedFormatter;
|
|
24
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-formatter-prompt-magic-contribution.d.ts","sourceRoot":"","sources":["../src/libro-formatter-prompt-magic-contribution.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAEL,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,sBAAuB,SAAQ,uBAAuB;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"libro-formatter-prompt-magic-contribution.d.ts","sourceRoot":"","sources":["../src/libro-formatter-prompt-magic-contribution.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAEL,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,sBAAuB,SAAQ,uBAAuB;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBACa,gCACX,YAAW,qBAAqB,CAAC,sBAAsB,CAAC;IAExD,SAAS,SAA4B;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,mBAAoB,MAAM,aAKjC;IAEF,MAAM,WAAY,sBAAsB;;;;;MAetC;IAEF,MAAM,mBAAoB,uBAAuB;;;;;;;;;;;;MAqB/C;IAEF,QAAQ,WAAY,sBAAsB,sCAExC;CACH"}
|
|
@@ -24,8 +24,11 @@ export var FormatterPromptMagicContribution = (_dec = singleton({
|
|
|
24
24
|
};
|
|
25
25
|
this.encode = function (source) {
|
|
26
26
|
var promptObj = {
|
|
27
|
-
model_name: source.modelType || '
|
|
28
|
-
prompt: source.value
|
|
27
|
+
model_name: source.modelType || 'chatgpt',
|
|
28
|
+
prompt: source.value,
|
|
29
|
+
variable_name: source.variableName,
|
|
30
|
+
cell_id: source.cellId,
|
|
31
|
+
record: source.record
|
|
29
32
|
};
|
|
30
33
|
var encodeValue = "%%prompt \n".concat(JSON.stringify(promptObj));
|
|
31
34
|
return {
|
|
@@ -42,9 +45,15 @@ export var FormatterPromptMagicContribution = (_dec = singleton({
|
|
|
42
45
|
var runValue = JSON.parse(run);
|
|
43
46
|
var codeValue = runValue.prompt;
|
|
44
47
|
var modelType = runValue.model_name;
|
|
48
|
+
var variableName = runValue.variable_name;
|
|
49
|
+
var cellId = runValue.cell_id;
|
|
50
|
+
var record = runValue.record;
|
|
45
51
|
return {
|
|
46
52
|
value: codeValue,
|
|
47
|
-
|
|
53
|
+
variableName: variableName,
|
|
54
|
+
modelType: modelType,
|
|
55
|
+
cellId: cellId,
|
|
56
|
+
record: record
|
|
48
57
|
};
|
|
49
58
|
}
|
|
50
59
|
return {
|
package/es/module.js
CHANGED
|
@@ -5,11 +5,11 @@ import { FormatterPromptMagicContribution } from "./libro-formatter-prompt-magic
|
|
|
5
5
|
import { LibroPromptCellCommandContribution } from "./prompt-cell-command-contribution.js";
|
|
6
6
|
import { PromptCellContribution } from "./prompt-cell-contribution.js";
|
|
7
7
|
import { LibroPromptCellModel } from "./prompt-cell-model.js";
|
|
8
|
-
import { LibroPromptOutputArea } from "./prompt-cell-output-area.js";
|
|
9
8
|
import { LibroPromptCellModelFactory } from "./prompt-cell-protocol.js";
|
|
9
|
+
import { PromptScript } from "./prompt-cell-script.js";
|
|
10
10
|
import { LibroPromptCellView } from "./prompt-cell-view.js";
|
|
11
11
|
import { LibroPromptOutputMimeTypeContribution } from "./prompt-output-rendermime-contribution.js";
|
|
12
|
-
export var LibroPromptCellModule = ManaModule.create().register(PromptCellContribution, LibroPromptCellView, LibroPromptCellModel,
|
|
12
|
+
export var LibroPromptCellModule = ManaModule.create().register(PromptCellContribution, PromptScript, LibroPromptCellView, LibroPromptCellModel, LibroPromptOutputMimeTypeContribution, LibroPromptCellCommandContribution, FormatterPromptMagicContribution, {
|
|
13
13
|
token: LibroPromptCellModelFactory,
|
|
14
14
|
useFactory: function useFactory(ctx) {
|
|
15
15
|
return function (options) {
|
|
@@ -16,12 +16,28 @@ export declare class LibroPromptCellModel extends LibroCellModel implements Exec
|
|
|
16
16
|
hasExecutedError: boolean;
|
|
17
17
|
metadata: Partial<PromptCellMetadata | ICellMetadata>;
|
|
18
18
|
kernelExecuting: boolean;
|
|
19
|
+
record: string;
|
|
19
20
|
modelType: string;
|
|
21
|
+
variableName: string;
|
|
20
22
|
executing: boolean;
|
|
21
23
|
hasOutputHidden: boolean;
|
|
22
24
|
hasOutputsScrolled: boolean;
|
|
23
25
|
msgChangeEmitter: Emitter<any>;
|
|
24
26
|
get msgChange(): ManaEvent<any>;
|
|
27
|
+
get decodeObject(): {
|
|
28
|
+
variableName: string;
|
|
29
|
+
modelType: string;
|
|
30
|
+
record: string;
|
|
31
|
+
value: string;
|
|
32
|
+
cellId: string;
|
|
33
|
+
};
|
|
34
|
+
set decodeObject(value: {
|
|
35
|
+
variableName: string;
|
|
36
|
+
modelType: string;
|
|
37
|
+
record: string;
|
|
38
|
+
value: string;
|
|
39
|
+
cellId: string;
|
|
40
|
+
});
|
|
25
41
|
viewManager: ViewManager;
|
|
26
42
|
constructor(options: CellOptions, viewManager: ViewManager);
|
|
27
43
|
toJSON(): Omit<ICodeCell, 'outputs'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-cell-model.d.ts","sourceRoot":"","sources":["../src/prompt-cell-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED,qBACa,oBACX,SAAQ,cACR,YAAW,mBAAmB;IAG9B,YAAY,EAAE,cAAc,CAAC;IAG7B,kBAAkB,UAAS;IAE3B,gBAAgB,UAAS;IAEhB,QAAQ,EAAE,OAAO,CAAC,kBAAkB,GAAG,aAAa,CAAC,CAAC;IAE/D,eAAe,UAAS;
|
|
1
|
+
{"version":3,"file":"prompt-cell-model.d.ts","sourceRoot":"","sources":["../src/prompt-cell-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED,qBACa,oBACX,SAAQ,cACR,YAAW,mBAAmB;IAG9B,YAAY,EAAE,cAAc,CAAC;IAG7B,kBAAkB,UAAS;IAE3B,gBAAgB,UAAS;IAEhB,QAAQ,EAAE,OAAO,CAAC,kBAAkB,GAAG,aAAa,CAAC,CAAC;IAE/D,eAAe,UAAS;IAGxB,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,EAAE,MAAM,CAAC;IAGlB,YAAY,EAAE,MAAM,CAAC;IAGrB,SAAS,EAAE,OAAO,CAAC;IAEnB,eAAe,EAAE,OAAO,CAAC;IAEzB,kBAAkB,EAAE,OAAO,CAAC;IAG5B,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAE/B,IAAI,SAAS,IAAI,SAAS,CAAC,GAAG,CAAC,CAE9B;IAED,IAAa,YAAY;;;;;;MASxB;IAED,IAAa,YAAY,CAAC,KAAK;;;;;;KAAA,EAK9B;IAED,WAAW,EAAE,WAAW,CAAC;gBAGF,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,WAAW;IAiBtC,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC;IAW7C,cAAc,IAAI,IAAI;IAKb,OAAO;IAKhB,SAAS;CAGV"}
|
package/es/prompt-cell-model.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8;
|
|
2
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11;
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
5
|
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
7
6
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
7
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
9
8
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
11
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
12
9
|
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
13
|
-
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
14
10
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
15
11
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
12
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17
13
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
18
14
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
19
15
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
|
+
function set(target, property, value, receiver) { if (typeof Reflect !== "undefined" && Reflect.set) { set = Reflect.set; } else { set = function set(target, property, value, receiver) { var base = _superPropBase(target, property); var desc; if (base) { desc = Object.getOwnPropertyDescriptor(base, property); if (desc.set) { desc.set.call(receiver, value); return true; } else if (!desc.writable) { return false; } } desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { _defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); }
|
|
17
|
+
function _set(target, property, value, receiver, isStrict) { var s = set(target, property, value, receiver || target); if (!s && isStrict) { throw new TypeError('failed to set property'); } return value; }
|
|
18
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
20
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
20
22
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21
23
|
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
22
24
|
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
@@ -27,7 +29,7 @@ import { transient } from '@difizen/mana-app';
|
|
|
27
29
|
import { prop } from '@difizen/mana-app';
|
|
28
30
|
import { ViewManager } from '@difizen/mana-app';
|
|
29
31
|
import { inject } from '@difizen/mana-app';
|
|
30
|
-
export var LibroPromptCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = prop(), _dec4 = prop(), _dec5 = prop(), _dec6 = prop(), _dec7 = prop(), _dec8 = prop(), _dec9 = prop(), _dec(_class = (_class2 = /*#__PURE__*/function (_LibroCellModel) {
|
|
32
|
+
export var LibroPromptCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = prop(), _dec4 = prop(), _dec5 = prop(), _dec6 = prop(), _dec7 = prop(), _dec8 = prop(), _dec9 = prop(), _dec10 = prop(), _dec11 = prop(), _dec12 = prop(), _dec(_class = (_class2 = /*#__PURE__*/function (_LibroCellModel) {
|
|
31
33
|
_inherits(LibroPromptCellModel, _LibroCellModel);
|
|
32
34
|
var _super = _createSuper(LibroPromptCellModel);
|
|
33
35
|
function LibroPromptCellModel(options, viewManager) {
|
|
@@ -40,10 +42,12 @@ export var LibroPromptCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = p
|
|
|
40
42
|
_initializerDefineProperty(_this, "hasExecutedError", _descriptor3, _assertThisInitialized(_this));
|
|
41
43
|
_initializerDefineProperty(_this, "metadata", _descriptor4, _assertThisInitialized(_this));
|
|
42
44
|
_initializerDefineProperty(_this, "kernelExecuting", _descriptor5, _assertThisInitialized(_this));
|
|
43
|
-
_this
|
|
44
|
-
_initializerDefineProperty(_this, "
|
|
45
|
-
_initializerDefineProperty(_this, "
|
|
46
|
-
_initializerDefineProperty(_this, "
|
|
45
|
+
_initializerDefineProperty(_this, "record", _descriptor6, _assertThisInitialized(_this));
|
|
46
|
+
_initializerDefineProperty(_this, "modelType", _descriptor7, _assertThisInitialized(_this));
|
|
47
|
+
_initializerDefineProperty(_this, "variableName", _descriptor8, _assertThisInitialized(_this));
|
|
48
|
+
_initializerDefineProperty(_this, "executing", _descriptor9, _assertThisInitialized(_this));
|
|
49
|
+
_initializerDefineProperty(_this, "hasOutputHidden", _descriptor10, _assertThisInitialized(_this));
|
|
50
|
+
_initializerDefineProperty(_this, "hasOutputsScrolled", _descriptor11, _assertThisInitialized(_this));
|
|
47
51
|
// Emitter Msg
|
|
48
52
|
_this.msgChangeEmitter = void 0;
|
|
49
53
|
_this.viewManager = void 0;
|
|
@@ -67,6 +71,23 @@ export var LibroPromptCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = p
|
|
|
67
71
|
get: function get() {
|
|
68
72
|
return this.msgChangeEmitter.event;
|
|
69
73
|
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "decodeObject",
|
|
76
|
+
get: function get() {
|
|
77
|
+
return _objectSpread(_objectSpread({}, this._decodeObject), {}, {
|
|
78
|
+
variableName: this.variableName,
|
|
79
|
+
modelType: this.modelType,
|
|
80
|
+
record: this.record,
|
|
81
|
+
value: this.value,
|
|
82
|
+
cellId: this.id
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
set: function set(value) {
|
|
86
|
+
_set(_getPrototypeOf(LibroPromptCellModel.prototype), "decodeObject", value, this, true);
|
|
87
|
+
this.variableName = value.variableName;
|
|
88
|
+
this.modelType = value.modelType;
|
|
89
|
+
this.record = value.record;
|
|
90
|
+
}
|
|
70
91
|
}, {
|
|
71
92
|
key: "toJSON",
|
|
72
93
|
value: function toJSON() {
|
|
@@ -129,17 +150,32 @@ export var LibroPromptCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = p
|
|
|
129
150
|
initializer: function initializer() {
|
|
130
151
|
return false;
|
|
131
152
|
}
|
|
132
|
-
}), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "
|
|
153
|
+
}), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "record", [_dec7], {
|
|
154
|
+
configurable: true,
|
|
155
|
+
enumerable: true,
|
|
156
|
+
writable: true,
|
|
157
|
+
initializer: null
|
|
158
|
+
}), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "modelType", [_dec8], {
|
|
159
|
+
configurable: true,
|
|
160
|
+
enumerable: true,
|
|
161
|
+
writable: true,
|
|
162
|
+
initializer: null
|
|
163
|
+
}), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "variableName", [_dec9], {
|
|
164
|
+
configurable: true,
|
|
165
|
+
enumerable: true,
|
|
166
|
+
writable: true,
|
|
167
|
+
initializer: null
|
|
168
|
+
}), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "executing", [_dec10], {
|
|
133
169
|
configurable: true,
|
|
134
170
|
enumerable: true,
|
|
135
171
|
writable: true,
|
|
136
172
|
initializer: null
|
|
137
|
-
}),
|
|
173
|
+
}), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "hasOutputHidden", [_dec11], {
|
|
138
174
|
configurable: true,
|
|
139
175
|
enumerable: true,
|
|
140
176
|
writable: true,
|
|
141
177
|
initializer: null
|
|
142
|
-
}),
|
|
178
|
+
}), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "hasOutputsScrolled", [_dec12], {
|
|
143
179
|
configurable: true,
|
|
144
180
|
enumerable: true,
|
|
145
181
|
writable: true,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
1
|
+
export declare class PromptScript {
|
|
2
|
+
readonly getChatObjects = "from libro_server import chat_object_manager\nchat_object_manager.dump_list_json()";
|
|
3
|
+
readonly getChatRecoreds = "from libro_server import chat_record_provider\nchat_record_provider.get_records()";
|
|
3
4
|
}
|
|
4
5
|
//# sourceMappingURL=prompt-cell-script.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-cell-script.d.ts","sourceRoot":"","sources":["../src/prompt-cell-script.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompt-cell-script.d.ts","sourceRoot":"","sources":["../src/prompt-cell-script.ts"],"names":[],"mappings":"AAEA,qBACa,YAAY;IACvB,SAAgB,cAAc,wFACM;IACpC,SAAgB,eAAe,uFACG;CACnC"}
|