@superinterface/react 2.22.3 → 2.23.0
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/index.cjs +213 -122
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -18
- package/dist/index.d.ts +23 -18
- package/dist/index.js +210 -123
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -21,7 +21,7 @@ declare const options: {
|
|
|
21
21
|
}) => any;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
type Args$
|
|
24
|
+
type Args$9 = {
|
|
25
25
|
children: React.ReactNode;
|
|
26
26
|
baseUrl?: string;
|
|
27
27
|
variables?: {
|
|
@@ -33,7 +33,7 @@ type Args$8 = {
|
|
|
33
33
|
};
|
|
34
34
|
threadIdCookieOptions?: typeof options | null;
|
|
35
35
|
};
|
|
36
|
-
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdCookieOptions, }: Args$
|
|
36
|
+
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdCookieOptions, }: Args$9) => react_jsx_runtime.JSX.Element;
|
|
37
37
|
|
|
38
38
|
declare const useSuperinterfaceContext: () => {
|
|
39
39
|
baseUrl: string | null;
|
|
@@ -46,14 +46,14 @@ declare const useSuperinterfaceContext: () => {
|
|
|
46
46
|
createMessageAbortControllerRef: React.MutableRefObject<AbortController | null>;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
type Args$
|
|
49
|
+
type Args$8 = Args$9;
|
|
50
50
|
|
|
51
|
-
type Args$
|
|
51
|
+
type Args$7 = Args$8;
|
|
52
52
|
|
|
53
|
-
type Args$
|
|
53
|
+
type Args$6 = Omit<Args$7, 'children'>;
|
|
54
54
|
declare const Thread: {
|
|
55
|
-
(props: Args$
|
|
56
|
-
Root: ({ children, ...rest }: Args$
|
|
55
|
+
(props: Args$6): react_jsx_runtime.JSX.Element;
|
|
56
|
+
Root: ({ children, ...rest }: Args$7) => react_jsx_runtime.JSX.Element;
|
|
57
57
|
Messages: {
|
|
58
58
|
({ children, style, }: {
|
|
59
59
|
children?: React.ReactNode;
|
|
@@ -338,10 +338,10 @@ declare const useMessageFormContext: () => {
|
|
|
338
338
|
isFileLoading: boolean;
|
|
339
339
|
};
|
|
340
340
|
|
|
341
|
-
type Args$
|
|
341
|
+
type Args$5 = {
|
|
342
342
|
assistantId: string;
|
|
343
343
|
};
|
|
344
|
-
declare const useAssistant: ({ assistantId, }: Args$
|
|
344
|
+
declare const useAssistant: ({ assistantId, }: Args$5) => {
|
|
345
345
|
assistant: any;
|
|
346
346
|
data: any;
|
|
347
347
|
error: Error;
|
|
@@ -540,14 +540,14 @@ declare const AudioThreadDialog: {
|
|
|
540
540
|
};
|
|
541
541
|
};
|
|
542
542
|
|
|
543
|
-
type Args$
|
|
543
|
+
type Args$4 = {
|
|
544
544
|
children: React.ReactNode;
|
|
545
545
|
};
|
|
546
546
|
|
|
547
|
-
type Args$
|
|
547
|
+
type Args$3 = Omit<Args$4, 'children'>;
|
|
548
548
|
declare const AudioThread: {
|
|
549
|
-
(props: Args$
|
|
550
|
-
Root: ({ children, }: Args$
|
|
549
|
+
(props: Args$3): react_jsx_runtime.JSX.Element;
|
|
550
|
+
Root: ({ children, }: Args$4) => react_jsx_runtime.JSX.Element;
|
|
551
551
|
Visualization: () => react_jsx_runtime.JSX.Element;
|
|
552
552
|
Form: () => react_jsx_runtime.JSX.Element;
|
|
553
553
|
};
|
|
@@ -649,12 +649,12 @@ type FunctionComponents = {
|
|
|
649
649
|
};
|
|
650
650
|
declare const FunctionComponentsContext: react.Context<FunctionComponents>;
|
|
651
651
|
|
|
652
|
-
type Args$
|
|
652
|
+
type Args$2 = {
|
|
653
653
|
fn: OpenAI.Beta.Threads.Runs.FunctionToolCall.Function;
|
|
654
654
|
runStep: OpenAI.Beta.Threads.Runs.RunStep;
|
|
655
655
|
title: string;
|
|
656
656
|
};
|
|
657
|
-
declare const FunctionBase: ({ fn, runStep, title, }: Args$
|
|
657
|
+
declare const FunctionBase: ({ fn, runStep, title, }: Args$2) => react_jsx_runtime.JSX.Element;
|
|
658
658
|
|
|
659
659
|
declare const ComponentsProvider: ({ children, ...rest }: {
|
|
660
660
|
children: React.ReactNode;
|
|
@@ -684,11 +684,11 @@ declare const useComponents: () => {
|
|
|
684
684
|
};
|
|
685
685
|
};
|
|
686
686
|
|
|
687
|
-
type Args = {
|
|
687
|
+
type Args$1 = {
|
|
688
688
|
runStep: SerializedRunStep;
|
|
689
689
|
};
|
|
690
690
|
declare const RunStep: {
|
|
691
|
-
({ runStep, }: Args): react_jsx_runtime.JSX.Element | null;
|
|
691
|
+
({ runStep, }: Args$1): react_jsx_runtime.JSX.Element | null;
|
|
692
692
|
ToolCalls: {
|
|
693
693
|
({ stepDetails, runStep, }: {
|
|
694
694
|
stepDetails: openai_resources_beta_threads_runs_steps.ToolCallsStepDetails;
|
|
@@ -705,4 +705,9 @@ declare const RunStep: {
|
|
|
705
705
|
};
|
|
706
706
|
};
|
|
707
707
|
|
|
708
|
-
|
|
708
|
+
type Args = {
|
|
709
|
+
children: React.ReactNode;
|
|
710
|
+
};
|
|
711
|
+
declare const AssistantProvider: ({ children, }: Args) => react_jsx_runtime.JSX.Element | null;
|
|
712
|
+
|
|
713
|
+
export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ declare const options: {
|
|
|
21
21
|
}) => any;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
type Args$
|
|
24
|
+
type Args$9 = {
|
|
25
25
|
children: React.ReactNode;
|
|
26
26
|
baseUrl?: string;
|
|
27
27
|
variables?: {
|
|
@@ -33,7 +33,7 @@ type Args$8 = {
|
|
|
33
33
|
};
|
|
34
34
|
threadIdCookieOptions?: typeof options | null;
|
|
35
35
|
};
|
|
36
|
-
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdCookieOptions, }: Args$
|
|
36
|
+
declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdCookieOptions, }: Args$9) => react_jsx_runtime.JSX.Element;
|
|
37
37
|
|
|
38
38
|
declare const useSuperinterfaceContext: () => {
|
|
39
39
|
baseUrl: string | null;
|
|
@@ -46,14 +46,14 @@ declare const useSuperinterfaceContext: () => {
|
|
|
46
46
|
createMessageAbortControllerRef: React.MutableRefObject<AbortController | null>;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
type Args$
|
|
49
|
+
type Args$8 = Args$9;
|
|
50
50
|
|
|
51
|
-
type Args$
|
|
51
|
+
type Args$7 = Args$8;
|
|
52
52
|
|
|
53
|
-
type Args$
|
|
53
|
+
type Args$6 = Omit<Args$7, 'children'>;
|
|
54
54
|
declare const Thread: {
|
|
55
|
-
(props: Args$
|
|
56
|
-
Root: ({ children, ...rest }: Args$
|
|
55
|
+
(props: Args$6): react_jsx_runtime.JSX.Element;
|
|
56
|
+
Root: ({ children, ...rest }: Args$7) => react_jsx_runtime.JSX.Element;
|
|
57
57
|
Messages: {
|
|
58
58
|
({ children, style, }: {
|
|
59
59
|
children?: React.ReactNode;
|
|
@@ -338,10 +338,10 @@ declare const useMessageFormContext: () => {
|
|
|
338
338
|
isFileLoading: boolean;
|
|
339
339
|
};
|
|
340
340
|
|
|
341
|
-
type Args$
|
|
341
|
+
type Args$5 = {
|
|
342
342
|
assistantId: string;
|
|
343
343
|
};
|
|
344
|
-
declare const useAssistant: ({ assistantId, }: Args$
|
|
344
|
+
declare const useAssistant: ({ assistantId, }: Args$5) => {
|
|
345
345
|
assistant: any;
|
|
346
346
|
data: any;
|
|
347
347
|
error: Error;
|
|
@@ -540,14 +540,14 @@ declare const AudioThreadDialog: {
|
|
|
540
540
|
};
|
|
541
541
|
};
|
|
542
542
|
|
|
543
|
-
type Args$
|
|
543
|
+
type Args$4 = {
|
|
544
544
|
children: React.ReactNode;
|
|
545
545
|
};
|
|
546
546
|
|
|
547
|
-
type Args$
|
|
547
|
+
type Args$3 = Omit<Args$4, 'children'>;
|
|
548
548
|
declare const AudioThread: {
|
|
549
|
-
(props: Args$
|
|
550
|
-
Root: ({ children, }: Args$
|
|
549
|
+
(props: Args$3): react_jsx_runtime.JSX.Element;
|
|
550
|
+
Root: ({ children, }: Args$4) => react_jsx_runtime.JSX.Element;
|
|
551
551
|
Visualization: () => react_jsx_runtime.JSX.Element;
|
|
552
552
|
Form: () => react_jsx_runtime.JSX.Element;
|
|
553
553
|
};
|
|
@@ -649,12 +649,12 @@ type FunctionComponents = {
|
|
|
649
649
|
};
|
|
650
650
|
declare const FunctionComponentsContext: react.Context<FunctionComponents>;
|
|
651
651
|
|
|
652
|
-
type Args$
|
|
652
|
+
type Args$2 = {
|
|
653
653
|
fn: OpenAI.Beta.Threads.Runs.FunctionToolCall.Function;
|
|
654
654
|
runStep: OpenAI.Beta.Threads.Runs.RunStep;
|
|
655
655
|
title: string;
|
|
656
656
|
};
|
|
657
|
-
declare const FunctionBase: ({ fn, runStep, title, }: Args$
|
|
657
|
+
declare const FunctionBase: ({ fn, runStep, title, }: Args$2) => react_jsx_runtime.JSX.Element;
|
|
658
658
|
|
|
659
659
|
declare const ComponentsProvider: ({ children, ...rest }: {
|
|
660
660
|
children: React.ReactNode;
|
|
@@ -684,11 +684,11 @@ declare const useComponents: () => {
|
|
|
684
684
|
};
|
|
685
685
|
};
|
|
686
686
|
|
|
687
|
-
type Args = {
|
|
687
|
+
type Args$1 = {
|
|
688
688
|
runStep: SerializedRunStep;
|
|
689
689
|
};
|
|
690
690
|
declare const RunStep: {
|
|
691
|
-
({ runStep, }: Args): react_jsx_runtime.JSX.Element | null;
|
|
691
|
+
({ runStep, }: Args$1): react_jsx_runtime.JSX.Element | null;
|
|
692
692
|
ToolCalls: {
|
|
693
693
|
({ stepDetails, runStep, }: {
|
|
694
694
|
stepDetails: openai_resources_beta_threads_runs_steps.ToolCallsStepDetails;
|
|
@@ -705,4 +705,9 @@ declare const RunStep: {
|
|
|
705
705
|
};
|
|
706
706
|
};
|
|
707
707
|
|
|
708
|
-
|
|
708
|
+
type Args = {
|
|
709
|
+
children: React.ReactNode;
|
|
710
|
+
};
|
|
711
|
+
declare const AssistantProvider: ({ children, }: Args) => react_jsx_runtime.JSX.Element | null;
|
|
712
|
+
|
|
713
|
+
export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
package/dist/index.js
CHANGED
|
@@ -1466,136 +1466,152 @@ var remarkAnnotation = function(param) {
|
|
|
1466
1466
|
return function() {
|
|
1467
1467
|
return function(tree) {
|
|
1468
1468
|
flatMap(tree, function(node) {
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
node
|
|
1476
|
-
];
|
|
1477
|
-
}
|
|
1478
|
-
if (!((_content_text = content.text) === null || _content_text === void 0 ? void 0 : (_content_text_annotations = _content_text.annotations) === null || _content_text_annotations === void 0 ? void 0 : _content_text_annotations.length)) {
|
|
1479
|
-
return [
|
|
1480
|
-
node
|
|
1481
|
-
];
|
|
1482
|
-
}
|
|
1483
|
-
if (!node.position) {
|
|
1484
|
-
return [
|
|
1485
|
-
node
|
|
1486
|
-
];
|
|
1487
|
-
}
|
|
1488
|
-
var nodeStart = node.position.start.offset;
|
|
1489
|
-
if (!isNumber(nodeStart)) {
|
|
1490
|
-
return [
|
|
1491
|
-
node
|
|
1492
|
-
];
|
|
1493
|
-
}
|
|
1494
|
-
var nodeEnd = node.position.end.offset;
|
|
1495
|
-
if (!isNumber(nodeEnd)) {
|
|
1469
|
+
if (node.type === "text" || node.type === "link") {
|
|
1470
|
+
return processNodeWithAnnotations({
|
|
1471
|
+
node: node,
|
|
1472
|
+
content: content
|
|
1473
|
+
});
|
|
1474
|
+
} else {
|
|
1496
1475
|
return [
|
|
1497
1476
|
node
|
|
1498
1477
|
];
|
|
1499
1478
|
}
|
|
1500
|
-
var newNodes = [];
|
|
1501
|
-
var lastProcessedIndex = nodeStart;
|
|
1502
|
-
sortedAnnotations({
|
|
1503
|
-
content: content
|
|
1504
|
-
}).forEach(function(annotation) {
|
|
1505
|
-
var annotationStart = annotation.start_index;
|
|
1506
|
-
var annotationEnd = annotation.end_index;
|
|
1507
|
-
if (nodeEnd < annotationStart || nodeStart > annotationEnd) {
|
|
1508
|
-
return;
|
|
1509
|
-
}
|
|
1510
|
-
if (node.type === "link") {
|
|
1511
|
-
if (annotation.type === "file_path") {
|
|
1512
|
-
console.log({
|
|
1513
|
-
annotation: annotation,
|
|
1514
|
-
node: node
|
|
1515
|
-
});
|
|
1516
|
-
newNodes.push(_object_spread_props(_object_spread({}, node), {
|
|
1517
|
-
type: "annotation",
|
|
1518
|
-
// @ts-ignore-next-line
|
|
1519
|
-
url: annotation.file_path.file_id,
|
|
1520
|
-
data: {
|
|
1521
|
-
hName: "annotation",
|
|
1522
|
-
hProperties: {
|
|
1523
|
-
annotation: annotation
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
}));
|
|
1527
|
-
}
|
|
1528
|
-
return;
|
|
1529
|
-
}
|
|
1530
|
-
var startIndex = Math.max(nodeStart, annotationStart);
|
|
1531
|
-
var endIndex = Math.min(nodeEnd, annotationEnd);
|
|
1532
|
-
if (lastProcessedIndex < startIndex) {
|
|
1533
|
-
newNodes.push({
|
|
1534
|
-
type: "text",
|
|
1535
|
-
value: node.value.slice(lastProcessedIndex - nodeStart, startIndex - nodeStart),
|
|
1536
|
-
position: {
|
|
1537
|
-
start: {
|
|
1538
|
-
line: node.position.start.line,
|
|
1539
|
-
column: node.position.start.column,
|
|
1540
|
-
offset: lastProcessedIndex
|
|
1541
|
-
},
|
|
1542
|
-
end: {
|
|
1543
|
-
line: node.position.end.line,
|
|
1544
|
-
column: node.position.end.column,
|
|
1545
|
-
offset: startIndex
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
});
|
|
1549
|
-
}
|
|
1550
|
-
newNodes.push({
|
|
1551
|
-
type: "annotation",
|
|
1552
|
-
value: node.value.slice(startIndex - nodeStart, endIndex - nodeStart),
|
|
1553
|
-
position: {
|
|
1554
|
-
start: {
|
|
1555
|
-
line: node.position.start.line,
|
|
1556
|
-
column: node.position.start.column,
|
|
1557
|
-
offset: startIndex
|
|
1558
|
-
},
|
|
1559
|
-
end: {
|
|
1560
|
-
line: node.position.end.line,
|
|
1561
|
-
column: node.position.end.column,
|
|
1562
|
-
offset: endIndex
|
|
1563
|
-
}
|
|
1564
|
-
},
|
|
1565
|
-
data: {
|
|
1566
|
-
hName: "annotation",
|
|
1567
|
-
hProperties: {
|
|
1568
|
-
annotation: annotation
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
});
|
|
1572
|
-
lastProcessedIndex = endIndex;
|
|
1573
|
-
});
|
|
1574
|
-
if (node.type === "text") {
|
|
1575
|
-
if (lastProcessedIndex < nodeEnd) {
|
|
1576
|
-
newNodes.push({
|
|
1577
|
-
type: "text",
|
|
1578
|
-
value: node.value.slice(lastProcessedIndex - nodeStart, nodeEnd - nodeStart),
|
|
1579
|
-
position: {
|
|
1580
|
-
start: {
|
|
1581
|
-
line: node.position.start.line,
|
|
1582
|
-
column: node.position.start.column,
|
|
1583
|
-
offset: lastProcessedIndex
|
|
1584
|
-
},
|
|
1585
|
-
end: {
|
|
1586
|
-
line: node.position.end.line,
|
|
1587
|
-
column: node.position.end.column,
|
|
1588
|
-
offset: nodeEnd
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
});
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
return newNodes;
|
|
1595
1479
|
});
|
|
1596
1480
|
};
|
|
1597
1481
|
};
|
|
1598
1482
|
};
|
|
1483
|
+
var processNodeWithAnnotations = function(param) {
|
|
1484
|
+
var node = param.node, content = param.content;
|
|
1485
|
+
var _content_text_annotations, _content_text;
|
|
1486
|
+
if (!((_content_text = content.text) === null || _content_text === void 0 ? void 0 : (_content_text_annotations = _content_text.annotations) === null || _content_text_annotations === void 0 ? void 0 : _content_text_annotations.length)) {
|
|
1487
|
+
return [
|
|
1488
|
+
node
|
|
1489
|
+
];
|
|
1490
|
+
}
|
|
1491
|
+
if (!node.position) {
|
|
1492
|
+
return [
|
|
1493
|
+
node
|
|
1494
|
+
];
|
|
1495
|
+
}
|
|
1496
|
+
var annotations = sortedAnnotations({
|
|
1497
|
+
content: content
|
|
1498
|
+
});
|
|
1499
|
+
if (node.type === "text") {
|
|
1500
|
+
return processTextNode({
|
|
1501
|
+
node: node,
|
|
1502
|
+
annotations: annotations
|
|
1503
|
+
});
|
|
1504
|
+
} else if (node.type === "link") {
|
|
1505
|
+
var linkNode = node;
|
|
1506
|
+
linkNode.children = flatMap(linkNode.children, function(childNode) {
|
|
1507
|
+
if (childNode.type === "text") {
|
|
1508
|
+
return processTextNode({
|
|
1509
|
+
node: childNode,
|
|
1510
|
+
annotations: annotations
|
|
1511
|
+
});
|
|
1512
|
+
} else {
|
|
1513
|
+
return [
|
|
1514
|
+
childNode
|
|
1515
|
+
];
|
|
1516
|
+
}
|
|
1517
|
+
});
|
|
1518
|
+
return [
|
|
1519
|
+
linkNode
|
|
1520
|
+
];
|
|
1521
|
+
} else {
|
|
1522
|
+
return [
|
|
1523
|
+
node
|
|
1524
|
+
];
|
|
1525
|
+
}
|
|
1526
|
+
};
|
|
1527
|
+
var processTextNode = function(param) {
|
|
1528
|
+
var node = param.node, annotations = param.annotations;
|
|
1529
|
+
if (!node.position || !node.value) {
|
|
1530
|
+
return [
|
|
1531
|
+
node
|
|
1532
|
+
];
|
|
1533
|
+
}
|
|
1534
|
+
var nodeStart = node.position.start.offset;
|
|
1535
|
+
var nodeEnd = node.position.end.offset;
|
|
1536
|
+
if (!isNumber(nodeStart) || !isNumber(nodeEnd)) {
|
|
1537
|
+
return [
|
|
1538
|
+
node
|
|
1539
|
+
];
|
|
1540
|
+
}
|
|
1541
|
+
var newNodes = [];
|
|
1542
|
+
var lastIndex = nodeStart;
|
|
1543
|
+
annotations.forEach(function(annotation) {
|
|
1544
|
+
var annotationStart = annotation.start_index;
|
|
1545
|
+
var annotationEnd = annotation.end_index;
|
|
1546
|
+
if (nodeEnd <= annotationStart || nodeStart >= annotationEnd) {
|
|
1547
|
+
return;
|
|
1548
|
+
}
|
|
1549
|
+
var start = Math.max(nodeStart, annotationStart);
|
|
1550
|
+
var end = Math.min(nodeEnd, annotationEnd);
|
|
1551
|
+
if (lastIndex < start) {
|
|
1552
|
+
newNodes.push(createTextNode({
|
|
1553
|
+
node: node,
|
|
1554
|
+
startOffset: lastIndex,
|
|
1555
|
+
endOffset: start
|
|
1556
|
+
}));
|
|
1557
|
+
}
|
|
1558
|
+
newNodes.push(createAnnotationNode({
|
|
1559
|
+
node: node,
|
|
1560
|
+
startOffset: start,
|
|
1561
|
+
endOffset: end,
|
|
1562
|
+
annotation: annotation
|
|
1563
|
+
}));
|
|
1564
|
+
lastIndex = end;
|
|
1565
|
+
});
|
|
1566
|
+
if (lastIndex < nodeEnd) {
|
|
1567
|
+
newNodes.push(createTextNode({
|
|
1568
|
+
node: node,
|
|
1569
|
+
startOffset: lastIndex,
|
|
1570
|
+
endOffset: nodeEnd
|
|
1571
|
+
}));
|
|
1572
|
+
}
|
|
1573
|
+
return newNodes;
|
|
1574
|
+
};
|
|
1575
|
+
var createTextNode = function(param) {
|
|
1576
|
+
var node = param.node, startOffset = param.startOffset, endOffset = param.endOffset;
|
|
1577
|
+
var valueStart = startOffset - node.position.start.offset;
|
|
1578
|
+
var valueEnd = endOffset - node.position.start.offset;
|
|
1579
|
+
return {
|
|
1580
|
+
type: "text",
|
|
1581
|
+
value: node.value.slice(valueStart, valueEnd),
|
|
1582
|
+
position: {
|
|
1583
|
+
start: _object_spread_props(_object_spread({}, node.position.start), {
|
|
1584
|
+
offset: startOffset
|
|
1585
|
+
}),
|
|
1586
|
+
end: _object_spread_props(_object_spread({}, node.position.end), {
|
|
1587
|
+
offset: endOffset
|
|
1588
|
+
})
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
};
|
|
1592
|
+
var createAnnotationNode = function(param) {
|
|
1593
|
+
var node = param.node, startOffset = param.startOffset, endOffset = param.endOffset, annotation = param.annotation;
|
|
1594
|
+
var valueStart = startOffset - node.position.start.offset;
|
|
1595
|
+
var valueEnd = endOffset - node.position.start.offset;
|
|
1596
|
+
return {
|
|
1597
|
+
type: "annotation",
|
|
1598
|
+
value: node.value.slice(valueStart, valueEnd),
|
|
1599
|
+
position: {
|
|
1600
|
+
start: _object_spread_props(_object_spread({}, node.position.start), {
|
|
1601
|
+
offset: startOffset
|
|
1602
|
+
}),
|
|
1603
|
+
end: _object_spread_props(_object_spread({}, node.position.end), {
|
|
1604
|
+
offset: endOffset
|
|
1605
|
+
})
|
|
1606
|
+
},
|
|
1607
|
+
data: {
|
|
1608
|
+
hName: "annotation",
|
|
1609
|
+
hProperties: {
|
|
1610
|
+
annotation: annotation
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
};
|
|
1614
|
+
};
|
|
1599
1615
|
// src/contexts/markdown/MarkdownContext/lib/getRemarkPlugins.ts
|
|
1600
1616
|
var getRemarkPlugins = function(param) {
|
|
1601
1617
|
var content = param.content;
|
|
@@ -5164,5 +5180,76 @@ var ComponentsProvider = function(_param) {
|
|
|
5164
5180
|
children: children
|
|
5165
5181
|
});
|
|
5166
5182
|
};
|
|
5167
|
-
|
|
5183
|
+
// src/components/assistants/AssistantProvider/index.tsx
|
|
5184
|
+
import { useMemo as useMemo20 } from "react";
|
|
5185
|
+
import { Theme } from "@radix-ui/themes";
|
|
5186
|
+
// src/components/assistants/AssistantProvider/Code.tsx
|
|
5187
|
+
import { useMemo as useMemo19 } from "react";
|
|
5188
|
+
import { jsx as jsx87 } from "react/jsx-runtime";
|
|
5189
|
+
var Code4 = function(param) {
|
|
5190
|
+
var children = param.children, className = param.className, markdownContext = param.markdownContext;
|
|
5191
|
+
var messageContext = useMessageContext();
|
|
5192
|
+
var isAssistantMessage = useMemo19(function() {
|
|
5193
|
+
var _messageContext_message;
|
|
5194
|
+
return ((_messageContext_message = messageContext.message) === null || _messageContext_message === void 0 ? void 0 : _messageContext_message.role) === "assistant";
|
|
5195
|
+
}, [
|
|
5196
|
+
messageContext
|
|
5197
|
+
]);
|
|
5198
|
+
if (!isAssistantMessage || className !== "language-suggestions") {
|
|
5199
|
+
return markdownContext.components.code({
|
|
5200
|
+
children: children,
|
|
5201
|
+
className: className
|
|
5202
|
+
});
|
|
5203
|
+
}
|
|
5204
|
+
return /* @__PURE__ */ jsx87(Suggestions, {
|
|
5205
|
+
children: children
|
|
5206
|
+
});
|
|
5207
|
+
};
|
|
5208
|
+
// src/components/assistants/AssistantProvider/index.tsx
|
|
5209
|
+
import { jsx as jsx88 } from "react/jsx-runtime";
|
|
5210
|
+
var AssistantProvider = function(param) {
|
|
5211
|
+
var children = param.children;
|
|
5212
|
+
var superinterfaceContext = useSuperinterfaceContext();
|
|
5213
|
+
var assistant = useAssistant({
|
|
5214
|
+
assistantId: superinterfaceContext.variables.assistantId
|
|
5215
|
+
}).assistant;
|
|
5216
|
+
var markdownContext = useMarkdownContext();
|
|
5217
|
+
var components2 = useMemo20(function() {
|
|
5218
|
+
return {
|
|
5219
|
+
code: function(props) {
|
|
5220
|
+
return(// @ts-ignore-next-line
|
|
5221
|
+
/* @__PURE__ */ jsx88(Code4, _object_spread_props(_object_spread({}, props), {
|
|
5222
|
+
markdownContext: markdownContext
|
|
5223
|
+
})));
|
|
5224
|
+
}
|
|
5225
|
+
};
|
|
5226
|
+
}, [
|
|
5227
|
+
markdownContext
|
|
5228
|
+
]);
|
|
5229
|
+
if (!assistant) {
|
|
5230
|
+
return null;
|
|
5231
|
+
}
|
|
5232
|
+
return /* @__PURE__ */ jsx88(Theme, {
|
|
5233
|
+
accentColor: assistant.theme.accentColor,
|
|
5234
|
+
grayColor: assistant.theme.grayColor,
|
|
5235
|
+
radius: assistant.theme.radius,
|
|
5236
|
+
appearance: assistant.theme.appearance,
|
|
5237
|
+
scaling: assistant.theme.scaling,
|
|
5238
|
+
panelBackground: "solid",
|
|
5239
|
+
hasBackground: false,
|
|
5240
|
+
children: /* @__PURE__ */ jsx88(AssistantNameContext.Provider, {
|
|
5241
|
+
value: assistant.name,
|
|
5242
|
+
children: /* @__PURE__ */ jsx88(AssistantAvatarContext.Provider, {
|
|
5243
|
+
value: /* @__PURE__ */ jsx88(Avatar6, {
|
|
5244
|
+
avatar: assistant.avatar
|
|
5245
|
+
}),
|
|
5246
|
+
children: /* @__PURE__ */ jsx88(MarkdownProvider, {
|
|
5247
|
+
components: components2,
|
|
5248
|
+
children: children
|
|
5249
|
+
})
|
|
5250
|
+
})
|
|
5251
|
+
})
|
|
5252
|
+
});
|
|
5253
|
+
};
|
|
5254
|
+
export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar6 as Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
|
|
5168
5255
|
//# sourceMappingURL=index.js.map
|