@agentuity/workbench 0.0.86 → 0.0.88
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/components/App.d.ts.map +1 -1
- package/dist/components/App.js +18 -2
- package/dist/components/App.js.map +1 -1
- package/dist/components/ai-elements/code-block.d.ts +3 -3
- package/dist/components/ai-elements/code-block.d.ts.map +1 -1
- package/dist/components/ai-elements/code-block.js +29 -7
- package/dist/components/ai-elements/code-block.js.map +1 -1
- package/dist/components/internal/Chat.d.ts +3 -2
- package/dist/components/internal/Chat.d.ts.map +1 -1
- package/dist/components/internal/Chat.js +23 -24
- package/dist/components/internal/Chat.js.map +1 -1
- package/dist/components/internal/InputSection.d.ts +3 -2
- package/dist/components/internal/InputSection.d.ts.map +1 -1
- package/dist/components/internal/InputSection.js +68 -6
- package/dist/components/internal/InputSection.js.map +1 -1
- package/dist/components/internal/MonacoJsonEditor.d.ts +3 -1
- package/dist/components/internal/MonacoJsonEditor.d.ts.map +1 -1
- package/dist/components/internal/MonacoJsonEditor.js +41 -57
- package/dist/components/internal/MonacoJsonEditor.js.map +1 -1
- package/dist/components/internal/Schema.d.ts +1 -2
- package/dist/components/internal/Schema.d.ts.map +1 -1
- package/dist/components/internal/Schema.js +2 -3
- package/dist/components/internal/Schema.js.map +1 -1
- package/dist/components/internal/WorkbenchProvider.d.ts.map +1 -1
- package/dist/components/internal/WorkbenchProvider.js +55 -8
- package/dist/components/internal/WorkbenchProvider.js.map +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/input-group.js +2 -2
- package/dist/components/ui/input-group.js.map +1 -1
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/input.js.map +1 -1
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/{styles.css → standalone.css} +206 -1554
- package/package.json +29 -29
- package/src/{styles.css → base.css} +36 -52
- package/src/components/App.tsx +41 -5
- package/src/components/ai-elements/code-block.tsx +42 -10
- package/src/components/internal/Chat.tsx +112 -119
- package/src/components/internal/InputSection.tsx +79 -9
- package/src/components/internal/MonacoJsonEditor.tsx +59 -65
- package/src/components/internal/Schema.tsx +74 -86
- package/src/components/internal/WorkbenchProvider.tsx +69 -10
- package/src/components/ui/input-group.tsx +2 -2
- package/src/components/ui/input.tsx +2 -3
- package/src/index.ts +5 -14
- package/src/integration.css +15 -0
- package/src/standalone.css +25 -0
- package/dist/components/ConnectionStatus.d.ts +0 -7
- package/dist/components/ConnectionStatus.d.ts.map +0 -1
- package/dist/components/ConnectionStatus.js +0 -52
- package/dist/components/ConnectionStatus.js.map +0 -1
- package/dist/components/Inline.d.ts +0 -10
- package/dist/components/Inline.d.ts.map +0 -1
- package/dist/components/Inline.js +0 -11
- package/dist/components/Inline.js.map +0 -1
- package/dist/components/ai-elements/artifact.d.ts +0 -24
- package/dist/components/ai-elements/artifact.d.ts.map +0 -1
- package/dist/components/ai-elements/artifact.js +0 -21
- package/dist/components/ai-elements/artifact.js.map +0 -1
- package/dist/components/ai-elements/branch.d.ts +0 -21
- package/dist/components/ai-elements/branch.d.ts.map +0 -1
- package/dist/components/ai-elements/branch.js +0 -71
- package/dist/components/ai-elements/branch.js.map +0 -1
- package/dist/components/ai-elements/canvas.d.ts +0 -9
- package/dist/components/ai-elements/canvas.d.ts.map +0 -1
- package/dist/components/ai-elements/canvas.js +0 -6
- package/dist/components/ai-elements/canvas.js.map +0 -1
- package/dist/components/ai-elements/chain-of-thought.d.ts +0 -30
- package/dist/components/ai-elements/chain-of-thought.d.ts.map +0 -1
- package/dist/components/ai-elements/chain-of-thought.js +0 -52
- package/dist/components/ai-elements/chain-of-thought.js.map +0 -1
- package/dist/components/ai-elements/confirmation.d.ts +0 -27
- package/dist/components/ai-elements/confirmation.d.ts.map +0 -1
- package/dist/components/ai-elements/confirmation.js +0 -57
- package/dist/components/ai-elements/confirmation.js.map +0 -1
- package/dist/components/ai-elements/connection.d.ts +0 -3
- package/dist/components/ai-elements/connection.d.ts.map +0 -1
- package/dist/components/ai-elements/connection.js +0 -4
- package/dist/components/ai-elements/connection.js.map +0 -1
- package/dist/components/ai-elements/context.d.ts +0 -33
- package/dist/components/ai-elements/context.d.ts.map +0 -1
- package/dist/components/ai-elements/context.js +0 -167
- package/dist/components/ai-elements/context.js.map +0 -1
- package/dist/components/ai-elements/controls.d.ts +0 -5
- package/dist/components/ai-elements/controls.d.ts.map +0 -1
- package/dist/components/ai-elements/controls.js +0 -6
- package/dist/components/ai-elements/controls.js.map +0 -1
- package/dist/components/ai-elements/edge.d.ts +0 -6
- package/dist/components/ai-elements/edge.d.ts.map +0 -1
- package/dist/components/ai-elements/edge.js +0 -83
- package/dist/components/ai-elements/edge.js.map +0 -1
- package/dist/components/ai-elements/image.d.ts +0 -7
- package/dist/components/ai-elements/image.d.ts.map +0 -1
- package/dist/components/ai-elements/image.js +0 -4
- package/dist/components/ai-elements/image.js.map +0 -1
- package/dist/components/ai-elements/inline-citation.d.ts +0 -39
- package/dist/components/ai-elements/inline-citation.d.ts.map +0 -1
- package/dist/components/ai-elements/inline-citation.js +0 -62
- package/dist/components/ai-elements/inline-citation.js.map +0 -1
- package/dist/components/ai-elements/loader.d.ts +0 -6
- package/dist/components/ai-elements/loader.d.ts.map +0 -1
- package/dist/components/ai-elements/loader.js +0 -5
- package/dist/components/ai-elements/loader.js.map +0 -1
- package/dist/components/ai-elements/node.d.ts +0 -22
- package/dist/components/ai-elements/node.d.ts.map +0 -1
- package/dist/components/ai-elements/node.js +0 -12
- package/dist/components/ai-elements/node.js.map +0 -1
- package/dist/components/ai-elements/open-in-chat.d.ts +0 -29
- package/dist/components/ai-elements/open-in-chat.d.ts.map +0 -1
- package/dist/components/ai-elements/open-in-chat.js +0 -97
- package/dist/components/ai-elements/open-in-chat.js.map +0 -1
- package/dist/components/ai-elements/panel.d.ts +0 -6
- package/dist/components/ai-elements/panel.d.ts.map +0 -1
- package/dist/components/ai-elements/panel.js +0 -5
- package/dist/components/ai-elements/panel.js.map +0 -1
- package/dist/components/ai-elements/plan.d.ts +0 -26
- package/dist/components/ai-elements/plan.d.ts.map +0 -1
- package/dist/components/ai-elements/plan.js +0 -32
- package/dist/components/ai-elements/plan.js.map +0 -1
- package/dist/components/ai-elements/queue.d.ts +0 -62
- package/dist/components/ai-elements/queue.d.ts.map +0 -1
- package/dist/components/ai-elements/queue.js +0 -25
- package/dist/components/ai-elements/queue.js.map +0 -1
- package/dist/components/ai-elements/reasoning.d.ts +0 -17
- package/dist/components/ai-elements/reasoning.d.ts.map +0 -1
- package/dist/components/ai-elements/reasoning.js +0 -77
- package/dist/components/ai-elements/reasoning.js.map +0 -1
- package/dist/components/ai-elements/response.d.ts +0 -6
- package/dist/components/ai-elements/response.d.ts.map +0 -1
- package/dist/components/ai-elements/response.js +0 -8
- package/dist/components/ai-elements/response.js.map +0 -1
- package/dist/components/ai-elements/sources.d.ts +0 -13
- package/dist/components/ai-elements/sources.d.ts.map +0 -1
- package/dist/components/ai-elements/sources.js +0 -10
- package/dist/components/ai-elements/sources.js.map +0 -1
- package/dist/components/ai-elements/suggestion.d.ts +0 -11
- package/dist/components/ai-elements/suggestion.d.ts.map +0 -1
- package/dist/components/ai-elements/suggestion.js +0 -13
- package/dist/components/ai-elements/suggestion.js.map +0 -1
- package/dist/components/ai-elements/task.d.ts +0 -15
- package/dist/components/ai-elements/task.d.ts.map +0 -1
- package/dist/components/ai-elements/task.js +0 -11
- package/dist/components/ai-elements/task.js.map +0 -1
- package/dist/components/ai-elements/tool.d.ts +0 -24
- package/dist/components/ai-elements/tool.d.ts.map +0 -1
- package/dist/components/ai-elements/tool.js +0 -47
- package/dist/components/ai-elements/tool.js.map +0 -1
- package/dist/components/ai-elements/toolbar.d.ts +0 -6
- package/dist/components/ai-elements/toolbar.d.ts.map +0 -1
- package/dist/components/ai-elements/toolbar.js +0 -5
- package/dist/components/ai-elements/toolbar.js.map +0 -1
- package/dist/components/ai-elements/web-preview.d.ts +0 -35
- package/dist/components/ai-elements/web-preview.d.ts.map +0 -1
- package/dist/components/ai-elements/web-preview.js +0 -63
- package/dist/components/ai-elements/web-preview.js.map +0 -1
- package/dist/components/ui/alert.d.ts +0 -10
- package/dist/components/ui/alert.d.ts.map +0 -1
- package/dist/components/ui/alert.js +0 -25
- package/dist/components/ui/alert.js.map +0 -1
- package/dist/components/ui/badge.d.ts +0 -10
- package/dist/components/ui/badge.d.ts.map +0 -1
- package/dist/components/ui/badge.js +0 -23
- package/dist/components/ui/badge.js.map +0 -1
- package/dist/components/ui/card.d.ts +0 -10
- package/dist/components/ui/card.d.ts.map +0 -1
- package/dist/components/ui/card.js +0 -25
- package/dist/components/ui/card.js.map +0 -1
- package/dist/components/ui/carousel.d.ts +0 -20
- package/dist/components/ui/carousel.d.ts.map +0 -1
- package/dist/components/ui/carousel.js +0 -92
- package/dist/components/ui/carousel.js.map +0 -1
- package/dist/components/ui/checkbox.d.ts +0 -5
- package/dist/components/ui/checkbox.d.ts.map +0 -1
- package/dist/components/ui/checkbox.js +0 -9
- package/dist/components/ui/checkbox.js.map +0 -1
- package/dist/components/ui/collapsible.d.ts +0 -6
- package/dist/components/ui/collapsible.d.ts.map +0 -1
- package/dist/components/ui/collapsible.js +0 -14
- package/dist/components/ui/collapsible.js.map +0 -1
- package/dist/components/ui/field.d.ts +0 -25
- package/dist/components/ui/field.d.ts.map +0 -1
- package/dist/components/ui/field.js +0 -74
- package/dist/components/ui/field.js.map +0 -1
- package/dist/components/ui/form.d.ts +0 -25
- package/dist/components/ui/form.d.ts.map +0 -1
- package/dist/components/ui/form.js +0 -58
- package/dist/components/ui/form.js.map +0 -1
- package/dist/components/ui/label.d.ts +0 -5
- package/dist/components/ui/label.d.ts.map +0 -1
- package/dist/components/ui/label.js +0 -9
- package/dist/components/ui/label.js.map +0 -1
- package/dist/components/ui/progress.d.ts +0 -5
- package/dist/components/ui/progress.d.ts.map +0 -1
- package/dist/components/ui/progress.js +0 -9
- package/dist/components/ui/progress.js.map +0 -1
- package/dist/components/ui/separator.d.ts +0 -5
- package/dist/components/ui/separator.d.ts.map +0 -1
- package/dist/components/ui/separator.js +0 -9
- package/dist/components/ui/separator.js.map +0 -1
- package/dist/components/ui/switch.d.ts +0 -5
- package/dist/components/ui/switch.d.ts.map +0 -1
- package/dist/components/ui/switch.js +0 -8
- package/dist/components/ui/switch.js.map +0 -1
- package/dist/components/ui/tabs.d.ts +0 -8
- package/dist/components/ui/tabs.d.ts.map +0 -1
- package/dist/components/ui/tabs.js +0 -17
- package/dist/components/ui/tabs.js.map +0 -1
- package/dist/components/ui/toggle.d.ts +0 -10
- package/dist/components/ui/toggle.d.ts.map +0 -1
- package/dist/components/ui/toggle.js +0 -26
- package/dist/components/ui/toggle.js.map +0 -1
- package/dist/components.d.ts +0 -12
- package/dist/components.d.ts.map +0 -1
- package/dist/components.js +0 -13
- package/dist/components.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -5
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/useWorkbenchSchemas.d.ts +0 -56
- package/dist/hooks/useWorkbenchSchemas.d.ts.map +0 -1
- package/dist/hooks/useWorkbenchSchemas.js +0 -63
- package/dist/hooks/useWorkbenchSchemas.js.map +0 -1
- package/src/components/ConnectionStatus.tsx +0 -67
- package/src/components/Inline.tsx +0 -16
- package/src/components/ai-elements/artifact.tsx +0 -118
- package/src/components/ai-elements/branch.tsx +0 -187
- package/src/components/ai-elements/canvas.tsx +0 -24
- package/src/components/ai-elements/chain-of-thought.tsx +0 -198
- package/src/components/ai-elements/confirmation.tsx +0 -119
- package/src/components/ai-elements/connection.tsx +0 -16
- package/src/components/ai-elements/context.tsx +0 -357
- package/src/components/ai-elements/controls.tsx +0 -18
- package/src/components/ai-elements/edge.tsx +0 -131
- package/src/components/ai-elements/image.tsx +0 -16
- package/src/components/ai-elements/inline-citation.tsx +0 -246
- package/src/components/ai-elements/loader.tsx +0 -88
- package/src/components/ai-elements/node.tsx +0 -66
- package/src/components/ai-elements/open-in-chat.tsx +0 -333
- package/src/components/ai-elements/panel.tsx +0 -12
- package/src/components/ai-elements/plan.tsx +0 -123
- package/src/components/ai-elements/queue.tsx +0 -231
- package/src/components/ai-elements/reasoning.tsx +0 -163
- package/src/components/ai-elements/response.tsx +0 -19
- package/src/components/ai-elements/sources.tsx +0 -53
- package/src/components/ai-elements/suggestion.tsx +0 -47
- package/src/components/ai-elements/task.tsx +0 -64
- package/src/components/ai-elements/tool.tsx +0 -136
- package/src/components/ai-elements/toolbar.tsx +0 -13
- package/src/components/ai-elements/web-preview.tsx +0 -238
- package/src/components/ui/alert.tsx +0 -60
- package/src/components/ui/badge.tsx +0 -40
- package/src/components/ui/card.tsx +0 -41
- package/src/components/ui/carousel.tsx +0 -234
- package/src/components/ui/checkbox.tsx +0 -27
- package/src/components/ui/collapsible.tsx +0 -21
- package/src/components/ui/field.tsx +0 -234
- package/src/components/ui/form.tsx +0 -154
- package/src/components/ui/label.tsx +0 -21
- package/src/components/ui/progress.tsx +0 -28
- package/src/components/ui/separator.tsx +0 -28
- package/src/components/ui/switch.tsx +0 -26
- package/src/components/ui/tabs.tsx +0 -52
- package/src/components/ui/toggle.tsx +0 -44
- package/src/components.tsx +0 -29
- package/src/hooks/index.ts +0 -20
- package/src/hooks/useWorkbenchSchemas.ts +0 -69
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { useWorkbench } from '../components/internal/WorkbenchProvider';
|
|
2
|
-
/**
|
|
3
|
-
* Hook to access agent schemas from the WorkbenchProvider context
|
|
4
|
-
* This is preferred over using useAgentSchemas directly in components
|
|
5
|
-
* since the provider manages the schema data centrally
|
|
6
|
-
*/
|
|
7
|
-
export function useWorkbenchSchemas() {
|
|
8
|
-
const { schemas, schemasLoading, schemasError, refetchSchemas } = useWorkbench();
|
|
9
|
-
return {
|
|
10
|
-
/** Raw schema data from the API */
|
|
11
|
-
schemas,
|
|
12
|
-
/** Whether schemas are currently loading */
|
|
13
|
-
isLoading: schemasLoading,
|
|
14
|
-
/** Any error that occurred while fetching schemas */
|
|
15
|
-
error: schemasError,
|
|
16
|
-
/** Function to refetch schemas from the API */
|
|
17
|
-
refetch: refetchSchemas,
|
|
18
|
-
/** Array of agent names available in schemas */
|
|
19
|
-
agentNames: schemas ? Object.keys(schemas.agents) : [],
|
|
20
|
-
/** Number of agents available */
|
|
21
|
-
agentCount: schemas ? Object.keys(schemas.agents).length : 0,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Hook to get a specific agent's schema by name
|
|
26
|
-
*/
|
|
27
|
-
export function useWorkbenchAgentSchema(agentName) {
|
|
28
|
-
const { schemas } = useWorkbench();
|
|
29
|
-
const agentData = schemas?.agents[agentName] || null;
|
|
30
|
-
return {
|
|
31
|
-
/** Agent schema data if found */
|
|
32
|
-
data: agentData,
|
|
33
|
-
/** Input schema for the agent */
|
|
34
|
-
inputSchema: agentData?.schema.input || null,
|
|
35
|
-
/** Output schema for the agent */
|
|
36
|
-
outputSchema: agentData?.schema.output || null,
|
|
37
|
-
/** Agent metadata */
|
|
38
|
-
metadata: agentData?.metadata || null,
|
|
39
|
-
/** Whether the agent exists in the current schemas */
|
|
40
|
-
exists: !!agentData,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Hook to get all agent schemas as an array
|
|
45
|
-
*/
|
|
46
|
-
export function useWorkbenchAllAgentSchemas() {
|
|
47
|
-
const { schemas } = useWorkbench();
|
|
48
|
-
const allAgents = schemas
|
|
49
|
-
? Object.entries(schemas.agents).map(([name, agentData]) => ({
|
|
50
|
-
name,
|
|
51
|
-
...agentData,
|
|
52
|
-
}))
|
|
53
|
-
: [];
|
|
54
|
-
return {
|
|
55
|
-
/** Array of all agent schema data */
|
|
56
|
-
agents: allAgents,
|
|
57
|
-
/** Whether any schemas are available */
|
|
58
|
-
hasSchemas: allAgents.length > 0,
|
|
59
|
-
/** Count of available schemas */
|
|
60
|
-
count: allAgents.length,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=useWorkbenchSchemas.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWorkbenchSchemas.js","sourceRoot":"","sources":["../../src/hooks/useWorkbenchSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IAClC,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,YAAY,EAAE,CAAC;IAEjF,OAAO;QACN,mCAAmC;QACnC,OAAO;QACP,4CAA4C;QAC5C,SAAS,EAAE,cAAc;QACzB,qDAAqD;QACrD,KAAK,EAAE,YAAY;QACnB,+CAA+C;QAC/C,OAAO,EAAE,cAAc;QACvB,gDAAgD;QAChD,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;QACtD,iCAAiC;QACjC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KAC5D,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,SAAiB;IACxD,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,EAAE,CAAC;IAEnC,MAAM,SAAS,GAAG,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC;IAErD,OAAO;QACN,iCAAiC;QACjC,IAAI,EAAE,SAAS;QACf,iCAAiC;QACjC,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,IAAI,IAAI;QAC5C,kCAAkC;QAClC,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,IAAI,IAAI;QAC9C,qBAAqB;QACrB,QAAQ,EAAE,SAAS,EAAE,QAAQ,IAAI,IAAI;QACrC,sDAAsD;QACtD,MAAM,EAAE,CAAC,CAAC,SAAS;KACnB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B;IAC1C,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,EAAE,CAAC;IAEnC,MAAM,SAAS,GAAG,OAAO;QACxB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;YAC3D,IAAI;YACJ,GAAG,SAAS;SACZ,CAAC,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;IAEN,OAAO;QACN,qCAAqC;QACrC,MAAM,EAAE,SAAS;QACjB,wCAAwC;QACxC,UAAU,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC;QAChC,iCAAiC;QACjC,KAAK,EAAE,SAAS,CAAC,MAAM;KACvB,CAAC;AACH,CAAC"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ConnectionStatus as ConnectionStatusType } from '../types/config';
|
|
3
|
-
|
|
4
|
-
interface ConnectionStatusProps {
|
|
5
|
-
status: ConnectionStatusType;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function ConnectionStatus({ status }: ConnectionStatusProps) {
|
|
9
|
-
if (status === 'connected') {
|
|
10
|
-
return null; // Don't show anything when connected normally
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const getStatusConfig = (status: ConnectionStatusType) => {
|
|
14
|
-
switch (status) {
|
|
15
|
-
case 'restarting':
|
|
16
|
-
return {
|
|
17
|
-
text: 'Server restarting...',
|
|
18
|
-
bgColor: 'bg-amber-100',
|
|
19
|
-
textColor: 'text-amber-800',
|
|
20
|
-
borderColor: 'border-amber-200',
|
|
21
|
-
icon: '🔄',
|
|
22
|
-
};
|
|
23
|
-
case 'disconnected':
|
|
24
|
-
return {
|
|
25
|
-
text: 'Disconnected from server',
|
|
26
|
-
bgColor: 'bg-red-100',
|
|
27
|
-
textColor: 'text-red-800',
|
|
28
|
-
borderColor: 'border-red-200',
|
|
29
|
-
icon: '⚠️',
|
|
30
|
-
};
|
|
31
|
-
case 'connected':
|
|
32
|
-
return {
|
|
33
|
-
text: 'Connected',
|
|
34
|
-
bgColor: 'bg-green-100',
|
|
35
|
-
textColor: 'text-green-800',
|
|
36
|
-
borderColor: 'border-green-200',
|
|
37
|
-
icon: '✅',
|
|
38
|
-
};
|
|
39
|
-
default:
|
|
40
|
-
return {
|
|
41
|
-
text: 'Unknown status',
|
|
42
|
-
bgColor: 'bg-gray-100',
|
|
43
|
-
textColor: 'text-gray-800',
|
|
44
|
-
borderColor: 'border-gray-200',
|
|
45
|
-
icon: '❓',
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const config = getStatusConfig(status);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<div
|
|
54
|
-
className={`
|
|
55
|
-
fixed top-0 left-0 right-0 z-50
|
|
56
|
-
px-4 py-2
|
|
57
|
-
${config.bgColor} ${config.textColor} ${config.borderColor}
|
|
58
|
-
border-b
|
|
59
|
-
text-center text-sm font-medium
|
|
60
|
-
transition-all duration-200 ease-in-out
|
|
61
|
-
`}
|
|
62
|
-
>
|
|
63
|
-
<span className="mr-2">{config.icon}</span>
|
|
64
|
-
{config.text}
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Chat } from './internal/Chat';
|
|
3
|
-
|
|
4
|
-
export interface InlineProps {
|
|
5
|
-
className?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Inline component - just the chat area
|
|
10
|
-
* Must be used within WorkbenchProvider
|
|
11
|
-
*/
|
|
12
|
-
export function Inline({ className }: InlineProps) {
|
|
13
|
-
return <Chat className={className} />;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default Inline;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Button } from '../ui/button';
|
|
4
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip';
|
|
5
|
-
import { cn } from '../../lib/utils';
|
|
6
|
-
import { type LucideIcon, XIcon } from 'lucide-react';
|
|
7
|
-
import type { ComponentProps, HTMLAttributes } from 'react';
|
|
8
|
-
|
|
9
|
-
export type ArtifactProps = HTMLAttributes<HTMLDivElement>;
|
|
10
|
-
|
|
11
|
-
export const Artifact = ({ className, ...props }: ArtifactProps) => (
|
|
12
|
-
<div
|
|
13
|
-
className={cn(
|
|
14
|
-
'flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm',
|
|
15
|
-
className
|
|
16
|
-
)}
|
|
17
|
-
{...props}
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export type ArtifactHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
22
|
-
|
|
23
|
-
export const ArtifactHeader = ({ className, ...props }: ArtifactHeaderProps) => (
|
|
24
|
-
<div
|
|
25
|
-
className={cn('flex items-center justify-between border-b bg-muted/50 px-4 py-3', className)}
|
|
26
|
-
{...props}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
export type ArtifactCloseProps = ComponentProps<typeof Button>;
|
|
31
|
-
|
|
32
|
-
export const ArtifactClose = ({
|
|
33
|
-
className,
|
|
34
|
-
children,
|
|
35
|
-
size = 'sm',
|
|
36
|
-
variant = 'ghost',
|
|
37
|
-
...props
|
|
38
|
-
}: ArtifactCloseProps) => (
|
|
39
|
-
<Button
|
|
40
|
-
className={cn('size-8 p-0 text-muted-foreground hover:text-foreground', className)}
|
|
41
|
-
size={size}
|
|
42
|
-
type="button"
|
|
43
|
-
variant={variant}
|
|
44
|
-
{...props}
|
|
45
|
-
>
|
|
46
|
-
{children ?? <XIcon className="size-4" />}
|
|
47
|
-
<span className="sr-only">Close</span>
|
|
48
|
-
</Button>
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
export type ArtifactTitleProps = HTMLAttributes<HTMLParagraphElement>;
|
|
52
|
-
|
|
53
|
-
export const ArtifactTitle = ({ className, ...props }: ArtifactTitleProps) => (
|
|
54
|
-
<p className={cn('font-medium text-foreground text-sm', className)} {...props} />
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
export type ArtifactDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
|
|
58
|
-
|
|
59
|
-
export const ArtifactDescription = ({ className, ...props }: ArtifactDescriptionProps) => (
|
|
60
|
-
<p className={cn('text-muted-foreground text-sm', className)} {...props} />
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
export type ArtifactActionsProps = HTMLAttributes<HTMLDivElement>;
|
|
64
|
-
|
|
65
|
-
export const ArtifactActions = ({ className, ...props }: ArtifactActionsProps) => (
|
|
66
|
-
<div className={cn('flex items-center gap-1', className)} {...props} />
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
export type ArtifactActionProps = ComponentProps<typeof Button> & {
|
|
70
|
-
tooltip?: string;
|
|
71
|
-
label?: string;
|
|
72
|
-
icon?: LucideIcon;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export const ArtifactAction = ({
|
|
76
|
-
tooltip,
|
|
77
|
-
label,
|
|
78
|
-
icon: Icon,
|
|
79
|
-
children,
|
|
80
|
-
className,
|
|
81
|
-
size = 'sm',
|
|
82
|
-
variant = 'ghost',
|
|
83
|
-
...props
|
|
84
|
-
}: ArtifactActionProps) => {
|
|
85
|
-
const button = (
|
|
86
|
-
<Button
|
|
87
|
-
className={cn('size-8 p-0 text-muted-foreground hover:text-foreground', className)}
|
|
88
|
-
size={size}
|
|
89
|
-
type="button"
|
|
90
|
-
variant={variant}
|
|
91
|
-
{...props}
|
|
92
|
-
>
|
|
93
|
-
{Icon ? <Icon className="size-4" /> : children}
|
|
94
|
-
<span className="sr-only">{label || tooltip}</span>
|
|
95
|
-
</Button>
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
if (tooltip) {
|
|
99
|
-
return (
|
|
100
|
-
<TooltipProvider>
|
|
101
|
-
<Tooltip>
|
|
102
|
-
<TooltipTrigger asChild>{button}</TooltipTrigger>
|
|
103
|
-
<TooltipContent>
|
|
104
|
-
<p>{tooltip}</p>
|
|
105
|
-
</TooltipContent>
|
|
106
|
-
</Tooltip>
|
|
107
|
-
</TooltipProvider>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return button;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export type ArtifactContentProps = HTMLAttributes<HTMLDivElement>;
|
|
115
|
-
|
|
116
|
-
export const ArtifactContent = ({ className, ...props }: ArtifactContentProps) => (
|
|
117
|
-
<div className={cn('flex-1 overflow-auto p-4', className)} {...props} />
|
|
118
|
-
);
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Button } from '../ui/button';
|
|
4
|
-
import { cn } from '../../lib/utils';
|
|
5
|
-
import type { UIMessage } from 'ai';
|
|
6
|
-
import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
|
|
7
|
-
import type { ComponentProps, HTMLAttributes, ReactElement } from 'react';
|
|
8
|
-
import { createContext, useContext, useEffect, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
type BranchContextType = {
|
|
11
|
-
currentBranch: number;
|
|
12
|
-
totalBranches: number;
|
|
13
|
-
goToPrevious: () => void;
|
|
14
|
-
goToNext: () => void;
|
|
15
|
-
branches: ReactElement[];
|
|
16
|
-
setBranches: (branches: ReactElement[]) => void;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const BranchContext = createContext<BranchContextType | null>(null);
|
|
20
|
-
|
|
21
|
-
const useBranch = () => {
|
|
22
|
-
const context = useContext(BranchContext);
|
|
23
|
-
|
|
24
|
-
if (!context) {
|
|
25
|
-
throw new Error('Branch components must be used within Branch');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return context;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export type BranchProps = HTMLAttributes<HTMLDivElement> & {
|
|
32
|
-
defaultBranch?: number;
|
|
33
|
-
onBranchChange?: (branchIndex: number) => void;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const Branch = ({ defaultBranch = 0, onBranchChange, className, ...props }: BranchProps) => {
|
|
37
|
-
const [currentBranch, setCurrentBranch] = useState(defaultBranch);
|
|
38
|
-
const [branches, setBranches] = useState<ReactElement[]>([]);
|
|
39
|
-
|
|
40
|
-
const handleBranchChange = (newBranch: number) => {
|
|
41
|
-
setCurrentBranch(newBranch);
|
|
42
|
-
onBranchChange?.(newBranch);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const goToPrevious = () => {
|
|
46
|
-
const newBranch = currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
|
|
47
|
-
handleBranchChange(newBranch);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const goToNext = () => {
|
|
51
|
-
const newBranch = currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
|
|
52
|
-
handleBranchChange(newBranch);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const contextValue: BranchContextType = {
|
|
56
|
-
currentBranch,
|
|
57
|
-
totalBranches: branches.length,
|
|
58
|
-
goToPrevious,
|
|
59
|
-
goToNext,
|
|
60
|
-
branches,
|
|
61
|
-
setBranches,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<BranchContext.Provider value={contextValue}>
|
|
66
|
-
<div className={cn('grid w-full gap-2 [&>div]:pb-0', className)} {...props} />
|
|
67
|
-
</BranchContext.Provider>
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export type BranchMessagesProps = HTMLAttributes<HTMLDivElement>;
|
|
72
|
-
|
|
73
|
-
export const BranchMessages = ({ children, ...props }: BranchMessagesProps) => {
|
|
74
|
-
const { currentBranch, setBranches, branches } = useBranch();
|
|
75
|
-
const childrenArray = Array.isArray(children) ? children : [children];
|
|
76
|
-
|
|
77
|
-
// Use useEffect to update branches when they change
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
if (branches.length !== childrenArray.length) {
|
|
80
|
-
setBranches(childrenArray);
|
|
81
|
-
}
|
|
82
|
-
}, [childrenArray, branches, setBranches]);
|
|
83
|
-
|
|
84
|
-
return childrenArray.map((branch, index) => (
|
|
85
|
-
<div
|
|
86
|
-
className={cn(
|
|
87
|
-
'grid gap-2 overflow-hidden [&>div]:pb-0',
|
|
88
|
-
index === currentBranch ? 'block' : 'hidden'
|
|
89
|
-
)}
|
|
90
|
-
key={branch.key}
|
|
91
|
-
{...props}
|
|
92
|
-
>
|
|
93
|
-
{branch}
|
|
94
|
-
</div>
|
|
95
|
-
));
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export type BranchSelectorProps = HTMLAttributes<HTMLDivElement> & {
|
|
99
|
-
from: UIMessage['role'];
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export const BranchSelector = ({ className, from, ...props }: BranchSelectorProps) => {
|
|
103
|
-
const { totalBranches } = useBranch();
|
|
104
|
-
|
|
105
|
-
// Don't render if there's only one branch
|
|
106
|
-
if (totalBranches <= 1) {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<div
|
|
112
|
-
className={cn(
|
|
113
|
-
'flex items-center gap-2 self-end px-10',
|
|
114
|
-
from === 'assistant' ? 'justify-start' : 'justify-end',
|
|
115
|
-
className
|
|
116
|
-
)}
|
|
117
|
-
{...props}
|
|
118
|
-
/>
|
|
119
|
-
);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
export type BranchPreviousProps = ComponentProps<typeof Button>;
|
|
123
|
-
|
|
124
|
-
export const BranchPrevious = ({ className, children, ...props }: BranchPreviousProps) => {
|
|
125
|
-
const { goToPrevious, totalBranches } = useBranch();
|
|
126
|
-
|
|
127
|
-
return (
|
|
128
|
-
<Button
|
|
129
|
-
aria-label="Previous branch"
|
|
130
|
-
className={cn(
|
|
131
|
-
'size-7 shrink-0 rounded-full text-muted-foreground transition-colors',
|
|
132
|
-
'hover:bg-accent hover:text-foreground',
|
|
133
|
-
'disabled:pointer-events-none disabled:opacity-50',
|
|
134
|
-
className
|
|
135
|
-
)}
|
|
136
|
-
disabled={totalBranches <= 1}
|
|
137
|
-
onClick={goToPrevious}
|
|
138
|
-
size="icon"
|
|
139
|
-
type="button"
|
|
140
|
-
variant="ghost"
|
|
141
|
-
{...props}
|
|
142
|
-
>
|
|
143
|
-
{children ?? <ChevronLeftIcon size={14} />}
|
|
144
|
-
</Button>
|
|
145
|
-
);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export type BranchNextProps = ComponentProps<typeof Button>;
|
|
149
|
-
|
|
150
|
-
export const BranchNext = ({ className, children, ...props }: BranchNextProps) => {
|
|
151
|
-
const { goToNext, totalBranches } = useBranch();
|
|
152
|
-
|
|
153
|
-
return (
|
|
154
|
-
<Button
|
|
155
|
-
aria-label="Next branch"
|
|
156
|
-
className={cn(
|
|
157
|
-
'size-7 shrink-0 rounded-full text-muted-foreground transition-colors',
|
|
158
|
-
'hover:bg-accent hover:text-foreground',
|
|
159
|
-
'disabled:pointer-events-none disabled:opacity-50',
|
|
160
|
-
className
|
|
161
|
-
)}
|
|
162
|
-
disabled={totalBranches <= 1}
|
|
163
|
-
onClick={goToNext}
|
|
164
|
-
size="icon"
|
|
165
|
-
type="button"
|
|
166
|
-
variant="ghost"
|
|
167
|
-
{...props}
|
|
168
|
-
>
|
|
169
|
-
{children ?? <ChevronRightIcon size={14} />}
|
|
170
|
-
</Button>
|
|
171
|
-
);
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
export type BranchPageProps = HTMLAttributes<HTMLSpanElement>;
|
|
175
|
-
|
|
176
|
-
export const BranchPage = ({ className, ...props }: BranchPageProps) => {
|
|
177
|
-
const { currentBranch, totalBranches } = useBranch();
|
|
178
|
-
|
|
179
|
-
return (
|
|
180
|
-
<span
|
|
181
|
-
className={cn('font-medium text-muted-foreground text-xs tabular-nums', className)}
|
|
182
|
-
{...props}
|
|
183
|
-
>
|
|
184
|
-
{currentBranch + 1} of {totalBranches}
|
|
185
|
-
</span>
|
|
186
|
-
);
|
|
187
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Background, ReactFlow, type ReactFlowProps } from '@xyflow/react';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
import '@xyflow/react/dist/style.css';
|
|
4
|
-
import { Controls } from './controls';
|
|
5
|
-
|
|
6
|
-
type CanvasProps = ReactFlowProps & {
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const Canvas = ({ children, ...props }: CanvasProps) => (
|
|
11
|
-
<ReactFlow
|
|
12
|
-
deleteKeyCode={['Backspace', 'Delete']}
|
|
13
|
-
fitView
|
|
14
|
-
panOnDrag={false}
|
|
15
|
-
panOnScroll
|
|
16
|
-
selectionOnDrag={true}
|
|
17
|
-
zoomOnDoubleClick={false}
|
|
18
|
-
{...props}
|
|
19
|
-
>
|
|
20
|
-
<Background bgColor="var(--sidebar)" />
|
|
21
|
-
<Controls />
|
|
22
|
-
{children}
|
|
23
|
-
</ReactFlow>
|
|
24
|
-
);
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
4
|
-
import { Badge } from '../ui/badge';
|
|
5
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible';
|
|
6
|
-
import { cn } from '../../lib/utils';
|
|
7
|
-
import { BrainIcon, ChevronDownIcon, DotIcon, type LucideIcon } from 'lucide-react';
|
|
8
|
-
import type { ComponentProps } from 'react';
|
|
9
|
-
import { createContext, memo, useContext, useMemo } from 'react';
|
|
10
|
-
|
|
11
|
-
type ChainOfThoughtContextValue = {
|
|
12
|
-
isOpen: boolean;
|
|
13
|
-
setIsOpen: (open: boolean) => void;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const ChainOfThoughtContext = createContext<ChainOfThoughtContextValue | null>(null);
|
|
17
|
-
|
|
18
|
-
const useChainOfThought = () => {
|
|
19
|
-
const context = useContext(ChainOfThoughtContext);
|
|
20
|
-
if (!context) {
|
|
21
|
-
throw new Error('ChainOfThought components must be used within ChainOfThought');
|
|
22
|
-
}
|
|
23
|
-
return context;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export type ChainOfThoughtProps = ComponentProps<'div'> & {
|
|
27
|
-
open?: boolean;
|
|
28
|
-
defaultOpen?: boolean;
|
|
29
|
-
onOpenChange?: (open: boolean) => void;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const ChainOfThought = memo(
|
|
33
|
-
({
|
|
34
|
-
className,
|
|
35
|
-
open,
|
|
36
|
-
defaultOpen = false,
|
|
37
|
-
onOpenChange,
|
|
38
|
-
children,
|
|
39
|
-
...props
|
|
40
|
-
}: ChainOfThoughtProps) => {
|
|
41
|
-
const [isOpen, setIsOpen] = useControllableState({
|
|
42
|
-
prop: open,
|
|
43
|
-
defaultProp: defaultOpen,
|
|
44
|
-
onChange: onOpenChange,
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const chainOfThoughtContext = useMemo(() => ({ isOpen, setIsOpen }), [isOpen, setIsOpen]);
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<ChainOfThoughtContext.Provider value={chainOfThoughtContext}>
|
|
51
|
-
<div className={cn('not-prose max-w-prose space-y-4', className)} {...props}>
|
|
52
|
-
{children}
|
|
53
|
-
</div>
|
|
54
|
-
</ChainOfThoughtContext.Provider>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
export type ChainOfThoughtHeaderProps = ComponentProps<typeof CollapsibleTrigger>;
|
|
60
|
-
|
|
61
|
-
export const ChainOfThoughtHeader = memo(
|
|
62
|
-
({ className, children, ...props }: ChainOfThoughtHeaderProps) => {
|
|
63
|
-
const { isOpen, setIsOpen } = useChainOfThought();
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<Collapsible onOpenChange={setIsOpen} open={isOpen}>
|
|
67
|
-
<CollapsibleTrigger
|
|
68
|
-
className={cn(
|
|
69
|
-
'flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground',
|
|
70
|
-
className
|
|
71
|
-
)}
|
|
72
|
-
{...props}
|
|
73
|
-
>
|
|
74
|
-
<BrainIcon className="size-4" />
|
|
75
|
-
<span className="flex-1 text-left">{children ?? 'Chain of Thought'}</span>
|
|
76
|
-
<ChevronDownIcon
|
|
77
|
-
className={cn('size-4 transition-transform', isOpen ? 'rotate-180' : 'rotate-0')}
|
|
78
|
-
/>
|
|
79
|
-
</CollapsibleTrigger>
|
|
80
|
-
</Collapsible>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
export type ChainOfThoughtStepProps = ComponentProps<'div'> & {
|
|
86
|
-
icon?: LucideIcon;
|
|
87
|
-
label: string;
|
|
88
|
-
description?: string;
|
|
89
|
-
status?: 'complete' | 'active' | 'pending';
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const ChainOfThoughtStep = memo(
|
|
93
|
-
({
|
|
94
|
-
className,
|
|
95
|
-
icon: Icon = DotIcon,
|
|
96
|
-
label,
|
|
97
|
-
description,
|
|
98
|
-
status = 'complete',
|
|
99
|
-
children,
|
|
100
|
-
...props
|
|
101
|
-
}: ChainOfThoughtStepProps) => {
|
|
102
|
-
const statusStyles = {
|
|
103
|
-
complete: 'text-muted-foreground',
|
|
104
|
-
active: 'text-foreground',
|
|
105
|
-
pending: 'text-muted-foreground/50',
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<div
|
|
110
|
-
className={cn(
|
|
111
|
-
'flex gap-2 text-sm',
|
|
112
|
-
statusStyles[status],
|
|
113
|
-
'fade-in-0 slide-in-from-top-2 animate-in',
|
|
114
|
-
className
|
|
115
|
-
)}
|
|
116
|
-
{...props}
|
|
117
|
-
>
|
|
118
|
-
<div className="relative mt-0.5">
|
|
119
|
-
<Icon className="size-4" />
|
|
120
|
-
<div className="-mx-px absolute top-7 bottom-0 left-1/2 w-px bg-border" />
|
|
121
|
-
</div>
|
|
122
|
-
<div className="flex-1 space-y-2">
|
|
123
|
-
<div>{label}</div>
|
|
124
|
-
{description && <div className="text-muted-foreground text-xs">{description}</div>}
|
|
125
|
-
{children}
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
export type ChainOfThoughtSearchResultsProps = ComponentProps<'div'>;
|
|
133
|
-
|
|
134
|
-
export const ChainOfThoughtSearchResults = memo(
|
|
135
|
-
({ className, ...props }: ChainOfThoughtSearchResultsProps) => (
|
|
136
|
-
<div className={cn('flex items-center gap-2', className)} {...props} />
|
|
137
|
-
)
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
export type ChainOfThoughtSearchResultProps = ComponentProps<typeof Badge>;
|
|
141
|
-
|
|
142
|
-
export const ChainOfThoughtSearchResult = memo(
|
|
143
|
-
({ className, children, ...props }: ChainOfThoughtSearchResultProps) => (
|
|
144
|
-
<Badge
|
|
145
|
-
className={cn('gap-1 px-2 py-0.5 font-normal text-xs', className)}
|
|
146
|
-
variant="secondary"
|
|
147
|
-
{...props}
|
|
148
|
-
>
|
|
149
|
-
{children}
|
|
150
|
-
</Badge>
|
|
151
|
-
)
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
export type ChainOfThoughtContentProps = ComponentProps<typeof CollapsibleContent>;
|
|
155
|
-
|
|
156
|
-
export const ChainOfThoughtContent = memo(
|
|
157
|
-
({ className, children, ...props }: ChainOfThoughtContentProps) => {
|
|
158
|
-
const { isOpen } = useChainOfThought();
|
|
159
|
-
|
|
160
|
-
return (
|
|
161
|
-
<Collapsible open={isOpen}>
|
|
162
|
-
<CollapsibleContent
|
|
163
|
-
className={cn(
|
|
164
|
-
'mt-2 space-y-3',
|
|
165
|
-
'data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in',
|
|
166
|
-
className
|
|
167
|
-
)}
|
|
168
|
-
{...props}
|
|
169
|
-
>
|
|
170
|
-
{children}
|
|
171
|
-
</CollapsibleContent>
|
|
172
|
-
</Collapsible>
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
export type ChainOfThoughtImageProps = ComponentProps<'div'> & {
|
|
178
|
-
caption?: string;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
export const ChainOfThoughtImage = memo(
|
|
182
|
-
({ className, children, caption, ...props }: ChainOfThoughtImageProps) => (
|
|
183
|
-
<div className={cn('mt-2 space-y-2', className)} {...props}>
|
|
184
|
-
<div className="relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg bg-muted p-3">
|
|
185
|
-
{children}
|
|
186
|
-
</div>
|
|
187
|
-
{caption && <p className="text-muted-foreground text-xs">{caption}</p>}
|
|
188
|
-
</div>
|
|
189
|
-
)
|
|
190
|
-
);
|
|
191
|
-
|
|
192
|
-
ChainOfThought.displayName = 'ChainOfThought';
|
|
193
|
-
ChainOfThoughtHeader.displayName = 'ChainOfThoughtHeader';
|
|
194
|
-
ChainOfThoughtStep.displayName = 'ChainOfThoughtStep';
|
|
195
|
-
ChainOfThoughtSearchResults.displayName = 'ChainOfThoughtSearchResults';
|
|
196
|
-
ChainOfThoughtSearchResult.displayName = 'ChainOfThoughtSearchResult';
|
|
197
|
-
ChainOfThoughtContent.displayName = 'ChainOfThoughtContent';
|
|
198
|
-
ChainOfThoughtImage.displayName = 'ChainOfThoughtImage';
|