@manta-eu/react 0.1.3 → 0.1.4
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 +2 -1
- package/dist/components/chat/chat-input/index.d.ts.map +1 -1
- package/dist/components/chat/chat-input/index.js +7 -0
- package/dist/components/chat-view/Chat.d.ts +2 -1
- package/dist/components/chat-view/Chat.d.ts.map +1 -1
- package/dist/components/chat-view/Chat.js +4 -2
- package/dist/components/embedded-chat/index.d.ts +1 -0
- package/dist/components/embedded-chat/index.d.ts.map +1 -1
- package/dist/components/embedded-chat/index.js +1 -1
- package/dist/hooks/use-composer-draft.d.ts +10 -0
- package/dist/hooks/use-composer-draft.d.ts.map +1 -0
- package/dist/hooks/use-composer-draft.js +20 -0
- package/dist/hooks/useAuth.d.ts +43 -0
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +46 -10
- package/dist/hooks/useValidateActionPlan.d.ts.map +1 -1
- package/dist/lib/chat-types.d.ts +5 -0
- package/dist/lib/chat-types.d.ts.map +1 -1
- package/dist/routes/chat/index.d.ts +2 -1
- package/dist/routes/chat/index.d.ts.map +1 -1
- package/dist/routes/chat/index.js +2 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -108,7 +108,8 @@ That is a working copilot. Everything below is optional.
|
|
|
108
108
|
| `title` | `string` | Header text |
|
|
109
109
|
| `assistantName` | `string` | What the assistant calls itself |
|
|
110
110
|
| `welcomeSubtitle` | `string` | Subtitle on the empty state |
|
|
111
|
-
| `initialPrompt` | `string` |
|
|
111
|
+
| `initialPrompt` | `string` | Sent as the first message of a new chat |
|
|
112
|
+
| `initialDraft` | `{ id, text }` | Prefills the composer; a new `id` re-seeds it |
|
|
112
113
|
| `mark` | `ReactNode` | Your logo in the header |
|
|
113
114
|
| `allowedModels` | `MantaModelId[]` | Restricts the model picker |
|
|
114
115
|
| `pageContext` | `PageContext` | Tells the assistant what the user is looking at |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/chat-input/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAQL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAGlB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AA6Bf,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAuFF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9C,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAMF,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/chat-input/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAQL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAGlB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AA6Bf,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAuFF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9C,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAMF,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAkH9C;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAc5D;AAOD,eAAO,MAAM,iBAAiB;gBAJhB,MAAM;eACP,CAAC,EAAE,EAAE,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI;uDAoD1D,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAoC1D;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,2CAmCtE;AA6ED,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC,CAAC;AAIF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,kDA6DpE"}
|
|
@@ -99,6 +99,13 @@ export function ChatInput(props) {
|
|
|
99
99
|
useEffect(() => {
|
|
100
100
|
store.getState().setOnRejected(onRejected ?? null);
|
|
101
101
|
}, [store, onRejected]);
|
|
102
|
+
// Mount only: puts the cursor after a seeded value. Focus stays with the textarea's `autoFocus`.
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
const textarea = store.getState().textareaRef.current;
|
|
105
|
+
if (!textarea?.value)
|
|
106
|
+
return;
|
|
107
|
+
textarea.setSelectionRange(textarea.value.length, textarea.value.length);
|
|
108
|
+
}, [store]);
|
|
102
109
|
const handleSubmit = useCallback(async (ev) => {
|
|
103
110
|
ev.preventDefault();
|
|
104
111
|
if (submittingRef.current)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ChatContext } from "@manta-eu/client/shared/agent-types";
|
|
2
2
|
import { type MantaModelId } from "@manta-eu/client/shared/model";
|
|
3
3
|
import type { ReactNode } from "react";
|
|
4
|
-
import type { CopilotMenuDefaults, Datastore, PageContext, User } from "#lib/chat-types";
|
|
4
|
+
import type { ChatDraft, CopilotMenuDefaults, Datastore, PageContext, User } from "#lib/chat-types";
|
|
5
5
|
export type ChatProps = {
|
|
6
6
|
datastore?: Datastore;
|
|
7
7
|
user: User;
|
|
@@ -13,6 +13,7 @@ export type ChatProps = {
|
|
|
13
13
|
pageContext?: PageContext;
|
|
14
14
|
allowedModels?: MantaModelId[];
|
|
15
15
|
initialPrompt?: string;
|
|
16
|
+
initialDraft?: ChatDraft;
|
|
16
17
|
title?: string;
|
|
17
18
|
welcomeSubtitle?: string;
|
|
18
19
|
mark?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/components/chat-view/Chat.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAGxF,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/components/chat-view/Chat.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAGxF,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgCvC,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAYpG,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,SAAS,EAAE,CAAC;CAClE,CAAC;AAuCF,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,2CAKpC;AAmBD,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC"}
|
|
@@ -22,6 +22,7 @@ import { StagedRuleCta } from "./StagedRuleCta.js";
|
|
|
22
22
|
import { isPendingRequestUserInputPart } from "./tool-part-rendering.js";
|
|
23
23
|
import { ChatInput, ChatInputAttachButton, ChatInputFilePreview, ChatInputFooter, ChatInputSubmit, ChatInputTextarea, ChatModelPicker, ChatWelcome, } from "#components/chat/index";
|
|
24
24
|
import { ReviewCta } from "#components/review-cta/index";
|
|
25
|
+
import { useComposerDraft } from "#hooks/use-composer-draft";
|
|
25
26
|
import { useShouldAutoFocusInput } from "#hooks/use-should-auto-focus-input";
|
|
26
27
|
import { useConversationGraphContext } from "#hooks/useConversationGraphContext";
|
|
27
28
|
import { useSelectedModel } from "#hooks/useSelectedModel";
|
|
@@ -108,7 +109,7 @@ function getChatWelcomeContent(args) {
|
|
|
108
109
|
.exhaustive();
|
|
109
110
|
}
|
|
110
111
|
function ChatContent(props) {
|
|
111
|
-
const { datastore, user, isCopilot, isEmbedded, isOperator, onCloseAction, pageContext, allowedModels, initialPrompt, title, welcomeSubtitle, mark, renderMenuItems, turnState, } = props;
|
|
112
|
+
const { datastore, user, isCopilot, isEmbedded, isOperator, onCloseAction, pageContext, allowedModels, initialPrompt, initialDraft, title, welcomeSubtitle, mark, renderMenuItems, turnState, } = props;
|
|
112
113
|
const assistantName = useAssistantName();
|
|
113
114
|
const { activeTurnKey, pendingAssistantTurn, resetChatTurn, setActiveTurnKey, setPendingAssistantTurn, setThinkingSeconds, thinkingSeconds, turnKeyRef, } = turnState;
|
|
114
115
|
const modelPickerOptions = isPresent(allowedModels) ? operatorModelOptionsFor(allowedModels) : operatorModelOptions;
|
|
@@ -208,6 +209,7 @@ function ChatContent(props) {
|
|
|
208
209
|
mantaBaseUrl,
|
|
209
210
|
datastorePath,
|
|
210
211
|
]);
|
|
212
|
+
const composerDraft = useComposerDraft(initialDraft, handleAgentSubmit);
|
|
211
213
|
const handleConversationStarterSubmit = useCallback((value) => {
|
|
212
214
|
void handleAgentSubmit(value, []);
|
|
213
215
|
}, [handleAgentSubmit]);
|
|
@@ -289,7 +291,7 @@ function ChatContent(props) {
|
|
|
289
291
|
.with({ ruleEditContext: P.nonNullable }, () => "Describe the change you'd like to make to this rule…")
|
|
290
292
|
.with({ isRuleCreateContext: true }, () => "Describe the rule you'd like to create…")
|
|
291
293
|
.otherwise(() => `Ask me anything about ${datastoreName ?? "your datastore"}...`);
|
|
292
|
-
const chatPanel = (_jsx("div", { ref: dropZoneRef, className: "relative h-full w-full min-w-0", children: _jsx("div", { ref: chatPanelRef, className: "h-full w-full overflow-y-auto overscroll-contain bg-base-background", children: _jsx(Conversation, { scrollRef: chatPanelRef, children: _jsxs("div", { className: "min-h-full flex flex-col", children: [_jsxs("div", { className: "sticky top-0 z-20", children: [connectionNotice, isCopilot && (_jsx(CopilotHeader, { isOperator: isOperator, datastoreId: datastore?.id, onClear: chatData?.clearHistory, onClose: onCloseAction, conversationId: activeConversation?.id, messages: chatData?.messages ?? [], isEmbedded: isEmbedded, renderMenuItems: renderMenuItems, title: title })), !isCopilot && ruleEditContext && (_jsx(RuleEditBanner, { ruleIri: ruleEditContext.ruleIri, ruleName: ruleEditName, onExit: () => startNewChat() }))] }), showGraphContextPanel && (_jsx("div", { className: "sticky top-0 z-10 h-0", children: _jsx(GraphContextPanel, { mergedGraph: graphContext.mergedGraph, graphCount: graphContext.graphCount, nodeCount: graphContext.nodeCount, sparqlQueries: graphContext.sparqlQueries }) })), _jsxs("div", { className: "flex-1 flex flex-col min-h-0", children: [!hasMessages && (_jsx("div", { "data-testid": "chat-welcome", className: "flex-1 flex flex-col items-center justify-center px-6 py-12", children: _jsxs("div", { className: "w-full max-w-4xl space-y-8 text-center", children: [_jsx(ChatWelcome, { channel: "MANTA", title: welcome.title, subtitle: welcome.subtitle, mark: mark }), _jsx(ConversationStarters, { onSubmit: handleConversationStarterSubmit, disabled: isChatInputDisabled })] }) })), hasMessages && (_jsx(MessagesContainer, { messages: displayMessages, toolsUsedInSession: toolsUsedInSession, onAddToolResult: addToolResult || (() => { }), status: status, thinkingSeconds: thinkingSeconds, activeTurnKey: activeTurnKey, compact: isCopilot, animateOnMount: !hasPendingMessage, turnError: turnError, onRetryTurn: () => void handleRetryTurn(), onStartNewChat: startNewChat }))] }), _jsxs("div", { className: cn("sticky bottom-0 z-20 py-2 px-4 space-y-2 w-full bg-base-background", !isCopilot && "max-w-3xl mx-auto", isCopilot && "pb-4"), children: [hasMessages && (_jsx("div", { className: "pointer-events-none absolute -top-10 left-0 right-0 h-10 bg-linear-to-t from-base-background to-transparent" })), _jsx(ConversationScrollButton, { className: "absolute -top-12 left-1/2 -translate-x-1/2 z-30" }), !isEmbedded && latestShowcase && (_jsx(ReviewCta, { title: humanizePlanName(latestShowcase.planName), subtitle: planStatusLabel(latestShowcase.status), className: "plan-badge-border gap-4 px-4 py-2 rounded-full", onClick: () => void handleSelectPlan(latestShowcase.planIri) })), !isEmbedded && isRuleCreateContext && _jsx(StagedRuleCta, { messages: agentMessages }), _jsxs(ChatInput, { dropTargetRef: dropZoneRef, onSubmit: isChatInputDisabled ? undefined :
|
|
294
|
+
const chatPanel = (_jsx("div", { ref: dropZoneRef, className: "relative h-full w-full min-w-0", children: _jsx("div", { ref: chatPanelRef, className: "h-full w-full overflow-y-auto overscroll-contain bg-base-background", children: _jsx(Conversation, { scrollRef: chatPanelRef, children: _jsxs("div", { className: "min-h-full flex flex-col", children: [_jsxs("div", { className: "sticky top-0 z-20", children: [connectionNotice, isCopilot && (_jsx(CopilotHeader, { isOperator: isOperator, datastoreId: datastore?.id, onClear: chatData?.clearHistory, onClose: onCloseAction, conversationId: activeConversation?.id, messages: chatData?.messages ?? [], isEmbedded: isEmbedded, renderMenuItems: renderMenuItems, title: title })), !isCopilot && ruleEditContext && (_jsx(RuleEditBanner, { ruleIri: ruleEditContext.ruleIri, ruleName: ruleEditName, onExit: () => startNewChat() }))] }), showGraphContextPanel && (_jsx("div", { className: "sticky top-0 z-10 h-0", children: _jsx(GraphContextPanel, { mergedGraph: graphContext.mergedGraph, graphCount: graphContext.graphCount, nodeCount: graphContext.nodeCount, sparqlQueries: graphContext.sparqlQueries }) })), _jsxs("div", { className: "flex-1 flex flex-col min-h-0", children: [!hasMessages && (_jsx("div", { "data-testid": "chat-welcome", className: "flex-1 flex flex-col items-center justify-center px-6 py-12", children: _jsxs("div", { className: "w-full max-w-4xl space-y-8 text-center", children: [_jsx(ChatWelcome, { channel: "MANTA", title: welcome.title, subtitle: welcome.subtitle, mark: mark }), _jsx(ConversationStarters, { onSubmit: handleConversationStarterSubmit, disabled: isChatInputDisabled })] }) })), hasMessages && (_jsx(MessagesContainer, { messages: displayMessages, toolsUsedInSession: toolsUsedInSession, onAddToolResult: addToolResult || (() => { }), status: status, thinkingSeconds: thinkingSeconds, activeTurnKey: activeTurnKey, compact: isCopilot, animateOnMount: !hasPendingMessage, turnError: turnError, onRetryTurn: () => void handleRetryTurn(), onStartNewChat: startNewChat }))] }), _jsxs("div", { className: cn("sticky bottom-0 z-20 py-2 px-4 space-y-2 w-full bg-base-background", !isCopilot && "max-w-3xl mx-auto", isCopilot && "pb-4"), children: [hasMessages && (_jsx("div", { className: "pointer-events-none absolute -top-10 left-0 right-0 h-10 bg-linear-to-t from-base-background to-transparent" })), _jsx(ConversationScrollButton, { className: "absolute -top-12 left-1/2 -translate-x-1/2 z-30" }), !isEmbedded && latestShowcase && (_jsx(ReviewCta, { title: humanizePlanName(latestShowcase.planName), subtitle: planStatusLabel(latestShowcase.status), className: "plan-badge-border gap-4 px-4 py-2 rounded-full", onClick: () => void handleSelectPlan(latestShowcase.planIri) })), !isEmbedded && isRuleCreateContext && _jsx(StagedRuleCta, { messages: agentMessages }), _jsxs(ChatInput, { initialValue: composerDraft.initialValue, dropTargetRef: dropZoneRef, onSubmit: isChatInputDisabled ? undefined : composerDraft.onSubmit, onRejected: handleFilesRejected, topContent: _jsx(ChatInputFilePreview, { progress: uploadProgress }), children: [!hasPendingQuestionnaire && _jsx(ChatInputAttachButton, {}), _jsx(ChatInputTextarea, { placeholder: composerPlaceholder, className: "pl-5", autoFocus: shouldAutoFocusInput, disabled: hasPendingQuestionnaire, "data-chat-input": true }), _jsx(ChatInputSubmit, { icon: ArrowUp, "aria-label": "Send", isLoading: isUploading, disabled: isChatInputDisabled, stopGeneration: !isResumeProbe && (isChatStreaming || chatStatus === "submitted") ? stop : undefined })] }, composerDraft.key), !isCopilot && (_jsx(ChatInputFooter, { infoText: "Manta can make mistakes.", version: kg.knowledgeGraphState?.dataVersion?.uniqueId ?? "unknown", circularProgressTooltip: "Context used (tokens)", min: agentState?.contextTokens ?? 0, max: contextWindow, actions: _jsxs(_Fragment, { children: [isOperator && modelPickerOptions.length > 1 && (_jsx(ChatModelPicker, { models: modelPickerOptions, selectedId: selectedModel, onChange: setSelectedModel })), showDebugMessages && _jsx(DebugMessagesButton, { messages: agentMessages })] }) }))] })] }) }) }) }));
|
|
293
295
|
if (isConnectingOrSyncing) {
|
|
294
296
|
return (_jsxs("div", { className: "relative", children: [_jsx(LoadingView, {}), activeChat?.connectionState === "closed" && (_jsx("div", { className: "absolute inset-x-0 top-0 z-20", children: connectionNotice }))] }));
|
|
295
297
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/embedded-chat/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAoB,KAAK,sBAAsB,EAA0C,MAAM,iBAAiB,CAAC;AAOxH,wBAAgB,YAAY,CAAC,KAAK,EAAE,sBAAsB,2CAazD"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/embedded-chat/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAoB,KAAK,sBAAsB,EAA0C,MAAM,iBAAiB,CAAC;AAOxH,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,wBAAgB,YAAY,CAAC,KAAK,EAAE,sBAAsB,2CAazD"}
|
|
@@ -46,5 +46,5 @@ function EmbeddedContent(props) {
|
|
|
46
46
|
if (isOperator && !activeDatastore) {
|
|
47
47
|
return (_jsx(EmbeddedDatastorePicker, { datastores: datastores, canSwitchDatastore: canSwitchDatastore, onDatastoreChosen: setChosenDatastore }));
|
|
48
48
|
}
|
|
49
|
-
return (_jsx(ChatManagerProvider, { datastoreId: activeDatastore?.id, onSelectPlan: onSelectPlan, children: _jsx(KnowledgeGraphStateProvider, { datastoreId: activeDatastore?.id, children: _jsx(KnowledgeGraphStartupGate, { embedded: true, children: _jsx(Chat, { datastore: activeDatastore, user: user, onLogout: onLogout, onCloseAction: onClose, isCopilot: true, isEmbedded: true, isOperator: isOperator, pageContext: props.pageContext, title: props.title, mark: props.mark, initialPrompt: props.initialPrompt, welcomeSubtitle: props.welcomeSubtitle, renderMenuItems: props.renderMenuItems }) }) }) }, activeDatastore?.id));
|
|
49
|
+
return (_jsx(ChatManagerProvider, { datastoreId: activeDatastore?.id, onSelectPlan: onSelectPlan, children: _jsx(KnowledgeGraphStateProvider, { datastoreId: activeDatastore?.id, children: _jsx(KnowledgeGraphStartupGate, { embedded: true, children: _jsx(Chat, { datastore: activeDatastore, user: user, onLogout: onLogout, onCloseAction: onClose, isCopilot: true, isEmbedded: true, isOperator: isOperator, pageContext: props.pageContext, title: props.title, mark: props.mark, initialPrompt: props.initialPrompt, initialDraft: props.initialDraft, welcomeSubtitle: props.welcomeSubtitle, renderMenuItems: props.renderMenuItems }) }) }) }, activeDatastore?.id));
|
|
50
50
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChatInputProps } from "#components/chat/chat-input/index";
|
|
2
|
+
import type { ChatDraft } from "#lib/chat-types";
|
|
3
|
+
type ComposerSubmit = NonNullable<ChatInputProps["onSubmit"]>;
|
|
4
|
+
export declare function useComposerDraft(initialDraft: ChatDraft | undefined, submit: ComposerSubmit): {
|
|
5
|
+
key: string;
|
|
6
|
+
initialValue: string | undefined;
|
|
7
|
+
onSubmit: (value: string, files: File[]) => void | Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=use-composer-draft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-composer-draft.d.ts","sourceRoot":"","sources":["../../src/hooks/use-composer-draft.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,KAAK,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;AAO9D,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,SAAS,GAAG,SAAS,EAAE,MAAM,EAAE,cAAc;;;sBAKhF,MAAM,SAAS,IAAI,EAAE;EAYhC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
// Module scope, so a remount of the whole chat (startup gate, datastore switch, the host moving
|
|
3
|
+
// its mount) does not bring back a draft the host still passes after it was sent.
|
|
4
|
+
const sentDraftIds = new Set();
|
|
5
|
+
// Props for `ChatInput`: a new draft `id` remounts it with the text, an undefined draft keeps it.
|
|
6
|
+
export function useComposerDraft(initialDraft, submit) {
|
|
7
|
+
const [seeded, setSeeded] = useState(initialDraft);
|
|
8
|
+
if (initialDraft && initialDraft.id !== seeded?.id)
|
|
9
|
+
setSeeded(initialDraft);
|
|
10
|
+
const onSubmit = useCallback((value, files) => {
|
|
11
|
+
if (seeded)
|
|
12
|
+
sentDraftIds.add(seeded.id);
|
|
13
|
+
return submit(value, files);
|
|
14
|
+
}, [seeded, submit]);
|
|
15
|
+
return {
|
|
16
|
+
key: seeded?.id ?? "composer",
|
|
17
|
+
initialValue: seeded && !sentDraftIds.has(seeded.id) ? seeded.text : undefined,
|
|
18
|
+
onSubmit,
|
|
19
|
+
};
|
|
20
|
+
}
|
package/dist/hooks/useAuth.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type MantaModelId } from "@manta-eu/client/shared/model";
|
|
2
2
|
import type { OrgRoleDefinition } from "@manta-eu/client/shared/org-roles";
|
|
3
|
+
import { z } from "zod";
|
|
3
4
|
import type { Datastore, User } from "../lib/chat-types.js";
|
|
4
5
|
export type LoginStatusCheck = {
|
|
5
6
|
isSessionValid: boolean;
|
|
@@ -26,5 +27,47 @@ export type UseAuthResult = {
|
|
|
26
27
|
/** Re-checks login status against the server, bypassing cached/stale state. */
|
|
27
28
|
refetchLoginStatus: () => Promise<LoginStatusCheck>;
|
|
28
29
|
};
|
|
30
|
+
export declare const contextResponseSchema: z.ZodObject<{
|
|
31
|
+
datastoreAccessGranted: z.ZodDefault<z.ZodBoolean>;
|
|
32
|
+
user: z.ZodObject<{
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
email: z.ZodString;
|
|
35
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
36
|
+
isOperator: z.ZodBoolean;
|
|
37
|
+
adminOrgs: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
38
|
+
memberOrgs: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
39
|
+
canManageIntegrations: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
40
|
+
canManageTeam: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
41
|
+
datastore: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
depth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
45
|
+
selectable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
46
|
+
badge: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
}, z.core.$strip>>>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
datastores: z.ZodArray<z.ZodObject<{
|
|
50
|
+
id: z.ZodString;
|
|
51
|
+
name: z.ZodString;
|
|
52
|
+
depth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
53
|
+
selectable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
54
|
+
badge: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
orgRoles: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
groupName: z.ZodString;
|
|
59
|
+
label: z.ZodString;
|
|
60
|
+
capabilities: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<("team:manage" | "org:settings" | "org:integrations")[], string[]>>;
|
|
61
|
+
}, z.core.$strip>>>>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export type ContextResponse = z.infer<typeof contextResponseSchema>;
|
|
64
|
+
export type SessionContextFailure = {
|
|
65
|
+
message?: string;
|
|
66
|
+
extensions?: {
|
|
67
|
+
status?: unknown;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export declare function parseSessionContext(payload: unknown): ContextResponse;
|
|
71
|
+
export declare function sessionContextFailure(failure: SessionContextFailure | undefined): Error | undefined;
|
|
29
72
|
export declare function useAuth(): UseAuthResult;
|
|
30
73
|
//# sourceMappingURL=useAuth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../src/hooks/useAuth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../src/hooks/useAuth.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAO3E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IACvB,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,kGAAkG;IAClG,cAAc,EAAE,OAAO,CAAC;IACxB,uGAAuG;IACvG,aAAa,EAAE,OAAO,CAAC;IACvB,sBAAsB,EAAE,OAAO,CAAC;IAChC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,+EAA+E;IAC/E,kBAAkB,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAuBF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAehC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,MAAM,MAAM,qBAAqB,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,CAAC;AAE5F,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CAErE;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,qBAAqB,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CAKnG;AAqBD,wBAAgB,OAAO,IAAI,aAAa,CA0IvC"}
|
package/dist/hooks/useAuth.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SessionContextDocument } from "@manta-eu/client";
|
|
1
2
|
import { datastoreHeader } from "@manta-eu/client/shared/datastore-path";
|
|
2
3
|
import { createHttpError, isHttpError } from "@manta-eu/client/shared/error-utils";
|
|
3
4
|
import { isValidModelId } from "@manta-eu/client/shared/model";
|
|
@@ -16,9 +17,9 @@ const loginStatusSchema = z.object({
|
|
|
16
17
|
const datastoreSchema = z.object({
|
|
17
18
|
id: z.string(),
|
|
18
19
|
name: z.string(),
|
|
19
|
-
depth: z.number().
|
|
20
|
-
selectable: z.boolean().
|
|
21
|
-
badge: z.string().
|
|
20
|
+
depth: z.number().nullish(),
|
|
21
|
+
selectable: z.boolean().nullish(),
|
|
22
|
+
badge: z.string().nullish(),
|
|
22
23
|
});
|
|
23
24
|
const orgRoleSchema = z.object({
|
|
24
25
|
id: z.string(),
|
|
@@ -26,7 +27,7 @@ const orgRoleSchema = z.object({
|
|
|
26
27
|
label: z.string(),
|
|
27
28
|
capabilities: z.array(z.string()).transform((values) => values.filter(isCapability)),
|
|
28
29
|
});
|
|
29
|
-
const contextResponseSchema = z.object({
|
|
30
|
+
export const contextResponseSchema = z.object({
|
|
30
31
|
datastoreAccessGranted: z.boolean().default(true),
|
|
31
32
|
user: z.object({
|
|
32
33
|
id: z.string(),
|
|
@@ -37,11 +38,22 @@ const contextResponseSchema = z.object({
|
|
|
37
38
|
memberOrgs: z.array(z.string()).optional().default([]),
|
|
38
39
|
canManageIntegrations: z.boolean().optional().default(false),
|
|
39
40
|
canManageTeam: z.boolean().optional().default(false),
|
|
40
|
-
datastore: datastoreSchema.
|
|
41
|
+
datastore: datastoreSchema.nullish(),
|
|
41
42
|
}),
|
|
42
43
|
datastores: z.array(datastoreSchema),
|
|
43
44
|
orgRoles: z.array(orgRoleSchema).optional().default([]),
|
|
44
45
|
});
|
|
46
|
+
export function parseSessionContext(payload) {
|
|
47
|
+
return contextResponseSchema.parse(payload);
|
|
48
|
+
}
|
|
49
|
+
export function sessionContextFailure(failure) {
|
|
50
|
+
if (!isPresent(failure?.message))
|
|
51
|
+
return undefined;
|
|
52
|
+
const status = failure.extensions?.status;
|
|
53
|
+
if (status === 401 || status === 403)
|
|
54
|
+
return createHttpError(failure.message, status);
|
|
55
|
+
return new Error(failure.message);
|
|
56
|
+
}
|
|
45
57
|
// A user with no datastore waits on an operator; the grant rides in the token, so recovery is a re-fetch.
|
|
46
58
|
const awaitingDatastorePollMs = 15_000;
|
|
47
59
|
function isAwaitingDatastore(context) {
|
|
@@ -49,6 +61,17 @@ function isAwaitingDatastore(context) {
|
|
|
49
61
|
return false;
|
|
50
62
|
return !context.user.isOperator && !isPresent(context.user.datastore);
|
|
51
63
|
}
|
|
64
|
+
function sessionDatastore(datastore) {
|
|
65
|
+
if (!isPresent(datastore))
|
|
66
|
+
return undefined;
|
|
67
|
+
return {
|
|
68
|
+
id: datastore.id,
|
|
69
|
+
name: datastore.name,
|
|
70
|
+
...(typeof datastore.depth === "number" ? { depth: datastore.depth } : {}),
|
|
71
|
+
...(typeof datastore.selectable === "boolean" ? { selectable: datastore.selectable } : {}),
|
|
72
|
+
...(isPresent(datastore.badge) ? { badge: datastore.badge } : {}),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
52
75
|
export function useAuth() {
|
|
53
76
|
const { mantaBaseUrl, datastoreId } = useMantaClient();
|
|
54
77
|
const queryClient = useQueryClient();
|
|
@@ -80,9 +103,15 @@ export function useAuth() {
|
|
|
80
103
|
const { data: contextData, isLoading: isContextLoading, error: contextError, } = useQuery({
|
|
81
104
|
queryKey: ["user-context", datastoreId],
|
|
82
105
|
queryFn: async ({ signal }) => {
|
|
83
|
-
const res = await fetch(new URL("/
|
|
106
|
+
const res = await fetch(new URL("/graphql", mantaBaseUrl), {
|
|
107
|
+
method: "POST",
|
|
84
108
|
credentials: "include",
|
|
85
|
-
headers: {
|
|
109
|
+
headers: {
|
|
110
|
+
...datastoreHeader(datastoreId),
|
|
111
|
+
Accept: "application/json",
|
|
112
|
+
"content-type": "application/json",
|
|
113
|
+
},
|
|
114
|
+
body: JSON.stringify({ query: SessionContextDocument }),
|
|
86
115
|
signal,
|
|
87
116
|
});
|
|
88
117
|
if (!res.ok) {
|
|
@@ -90,7 +119,11 @@ export function useAuth() {
|
|
|
90
119
|
const message = body?.error ?? "user not available";
|
|
91
120
|
throw createHttpError(message, res.status);
|
|
92
121
|
}
|
|
93
|
-
|
|
122
|
+
const body = (await res.json());
|
|
123
|
+
const failure = sessionContextFailure(body.errors?.[0]);
|
|
124
|
+
if (isPresent(failure))
|
|
125
|
+
throw failure;
|
|
126
|
+
return parseSessionContext(body.data?.sessionContext);
|
|
94
127
|
},
|
|
95
128
|
enabled: contextEnabled,
|
|
96
129
|
retry: false,
|
|
@@ -134,8 +167,11 @@ export function useAuth() {
|
|
|
134
167
|
}, [refetchLoginStatusQuery]);
|
|
135
168
|
return {
|
|
136
169
|
user,
|
|
137
|
-
datastore: contextData?.user?.datastore,
|
|
138
|
-
datastores: contextData?.datastores
|
|
170
|
+
datastore: sessionDatastore(contextData?.user?.datastore),
|
|
171
|
+
datastores: contextData?.datastores.flatMap((row) => {
|
|
172
|
+
const datastore = sessionDatastore(row);
|
|
173
|
+
return isPresent(datastore) ? [datastore] : [];
|
|
174
|
+
}),
|
|
139
175
|
datastoreAccessGranted: contextData?.datastoreAccessGranted ?? true,
|
|
140
176
|
isOperator: contextData?.user?.isOperator ?? false,
|
|
141
177
|
canManageTeam: contextData?.user?.canManageTeam ?? false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useValidateActionPlan.d.ts","sourceRoot":"","sources":["../../src/hooks/useValidateActionPlan.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,GAAG,SAAS;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useValidateActionPlan.d.ts","sourceRoot":"","sources":["../../src/hooks/useValidateActionPlan.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,GAAG,SAAS;;;;;;;;;sBAkBywmJ,CAAC;;sBAAwF,CAAC;iBAAsC,CAAC;uBAA4C,CAAC;;;mBAAuI,CAAC;;;;;EAD3pnJ"}
|
package/dist/lib/chat-types.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export type CopilotMenuDefaults = {
|
|
|
14
14
|
debugMessages: ReactNode | null;
|
|
15
15
|
clearChat: ReactNode | null;
|
|
16
16
|
};
|
|
17
|
+
export type ChatDraft = {
|
|
18
|
+
id: string;
|
|
19
|
+
text: string;
|
|
20
|
+
};
|
|
17
21
|
export type AuthenticatedChatProps = {
|
|
18
22
|
datastore?: Datastore;
|
|
19
23
|
user: User;
|
|
@@ -28,6 +32,7 @@ export type AuthenticatedChatProps = {
|
|
|
28
32
|
pageContext?: PageContext;
|
|
29
33
|
allowedModels?: MantaModelId[];
|
|
30
34
|
initialPrompt?: string;
|
|
35
|
+
initialDraft?: ChatDraft;
|
|
31
36
|
title?: string;
|
|
32
37
|
welcomeSubtitle?: string;
|
|
33
38
|
assistantName?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-types.d.ts","sourceRoot":"","sources":["../../src/lib/chat-types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAExE,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,SAAS,GAAG,IAAI,CAAC;IAChC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;CAC7B,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-types.d.ts","sourceRoot":"","sources":["../../src/lib/chat-types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAExE,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,SAAS,GAAG,IAAI,CAAC;IAChC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAGrD,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,SAAS,EAAE,CAAC;CAClE,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,sBAAsB,GAAG;IACvD,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,sBAAsB,GAAG,iBAAiB,CAEjF;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MantaModelId } from "@manta-eu/client/shared/model";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
|
-
import type { Datastore, User } from "#lib/chat-types";
|
|
3
|
+
import type { ChatDraft, Datastore, User } from "#lib/chat-types";
|
|
4
4
|
type ChatRouteProps = {
|
|
5
5
|
datastore?: Datastore;
|
|
6
6
|
user: User;
|
|
@@ -10,6 +10,7 @@ type ChatRouteProps = {
|
|
|
10
10
|
datastores?: Datastore[];
|
|
11
11
|
allowedModels?: MantaModelId[];
|
|
12
12
|
initialPrompt?: string;
|
|
13
|
+
initialDraft?: ChatDraft;
|
|
13
14
|
title?: string;
|
|
14
15
|
welcomeSubtitle?: string;
|
|
15
16
|
assistantName?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/chat/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/chat/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGlE,KAAK,cAAc,GAAG;IACpB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CA4C9C"}
|
|
@@ -3,6 +3,6 @@ import { Chat } from "#components/chat-view/index";
|
|
|
3
3
|
import { RouteLayout } from "#components/layouts/RouteLayout";
|
|
4
4
|
import { AssistantNameProvider } from "#providers/AssistantNameProvider";
|
|
5
5
|
export function ChatRoute(props) {
|
|
6
|
-
const { datastore, user, logout, isOperator, canSwitchDatastore, datastores, allowedModels, initialPrompt, title, welcomeSubtitle, assistantName, mark, } = props;
|
|
7
|
-
return (_jsx(AssistantNameProvider, { name: assistantName, children: _jsx(RouteLayout, { user: user, datastore: datastore, datastores: datastores, isOperator: isOperator, canSwitchDatastore: canSwitchDatastore, logout: logout, floatingMobileMenu: true, title: title, mark: mark, children: _jsx(Chat, { datastore: datastore, user: user, onLogout: logout, isOperator: isOperator, allowedModels: allowedModels, initialPrompt: initialPrompt, welcomeSubtitle: welcomeSubtitle, mark: mark }) }) }));
|
|
6
|
+
const { datastore, user, logout, isOperator, canSwitchDatastore, datastores, allowedModels, initialPrompt, initialDraft, title, welcomeSubtitle, assistantName, mark, } = props;
|
|
7
|
+
return (_jsx(AssistantNameProvider, { name: assistantName, children: _jsx(RouteLayout, { user: user, datastore: datastore, datastores: datastores, isOperator: isOperator, canSwitchDatastore: canSwitchDatastore, logout: logout, floatingMobileMenu: true, title: title, mark: mark, children: _jsx(Chat, { datastore: datastore, user: user, onLogout: logout, isOperator: isOperator, allowedModels: allowedModels, initialPrompt: initialPrompt, initialDraft: initialDraft, welcomeSubtitle: welcomeSubtitle, mark: mark }) }) }));
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manta-eu/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "The Manta design system, knowledge-graph UI and agent components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1085,11 +1085,11 @@
|
|
|
1085
1085
|
"usehooks-ts": "^3.1.1",
|
|
1086
1086
|
"zod": "^4.5.0",
|
|
1087
1087
|
"zustand": "^5.0.2",
|
|
1088
|
-
"@manta-eu/client": "0.1.
|
|
1089
|
-
"@manta-eu/ldo": "0.1.
|
|
1090
|
-
"@manta-eu/
|
|
1091
|
-
"@manta-eu/rdf-lib": "0.1.
|
|
1092
|
-
"@manta-eu/
|
|
1088
|
+
"@manta-eu/client": "0.1.4",
|
|
1089
|
+
"@manta-eu/ldo": "0.1.4",
|
|
1090
|
+
"@manta-eu/lib": "0.1.4",
|
|
1091
|
+
"@manta-eu/rdf-lib": "0.1.4",
|
|
1092
|
+
"@manta-eu/datalog-parser": "0.1.4"
|
|
1093
1093
|
},
|
|
1094
1094
|
"peerDependencies": {
|
|
1095
1095
|
"@ulb-darmstadt/shacl-form": "^2.1.1-rc1",
|