@sybilion/uilib 1.3.52 → 1.3.53
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/esm/components/ui/Chat/ChatSheet/ChatSheet.js +1 -0
- package/dist/esm/components/ui/Chat/ChatSheet/useChatPanelChromeModel.js +12 -0
- package/dist/esm/types/src/components/ui/Chat/ChatSheet/ChatSheet.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Chat/ChatSheet/useChatPanelChromeModel.d.ts +2 -0
- package/package.json +3 -2
- package/src/components/ui/Chat/ChatSheet/ChatSheet.tsx +3 -0
- package/src/components/ui/Chat/ChatSheet/useChatPanelChromeModel.tsx +20 -0
|
@@ -149,6 +149,16 @@ function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onS
|
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
const isEmpty = isChatEmpty(chat) && !isLoading;
|
|
152
|
+
const openNewChatWithPrefill = useCallback((prompt) => {
|
|
153
|
+
const sessionId = newChat();
|
|
154
|
+
if (sessionId == null) {
|
|
155
|
+
logger.warn('Chat prefill: sign in to use the assistant.');
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const trimmed = prompt.trim();
|
|
159
|
+
setPromptLinkPrefill(trimmed || null);
|
|
160
|
+
onOpenChange(true);
|
|
161
|
+
}, [newChat, onOpenChange]);
|
|
152
162
|
/**
|
|
153
163
|
* App link: `?prompt=…` — open panel, pre-fill composer, strip param (read once on mount
|
|
154
164
|
* from `location.search`). If the selected session already has messages, `newChat()` first.
|
|
@@ -401,6 +411,7 @@ function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onS
|
|
|
401
411
|
}
|
|
402
412
|
}
|
|
403
413
|
}
|
|
414
|
+
setPromptLinkPrefill(null);
|
|
404
415
|
try {
|
|
405
416
|
if (chatId)
|
|
406
417
|
endLocalDemoFlow(chatId);
|
|
@@ -769,6 +780,7 @@ function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onS
|
|
|
769
780
|
onOpenChange,
|
|
770
781
|
toggleOpen,
|
|
771
782
|
newChat,
|
|
783
|
+
openNewChatWithPrefill,
|
|
772
784
|
chatPanelContainer,
|
|
773
785
|
};
|
|
774
786
|
}
|
|
@@ -3,6 +3,8 @@ export type ChatSheetActions = {
|
|
|
3
3
|
open: () => void;
|
|
4
4
|
/** Starts a new chat session and opens the panel (same as the new-chat keyboard shortcut). */
|
|
5
5
|
openNewChat: () => void;
|
|
6
|
+
/** Starts a new chat, opens the panel, and pre-fills the composer (user sends manually). */
|
|
7
|
+
openNewChatWithPrefill: (prompt: string) => void;
|
|
6
8
|
};
|
|
7
9
|
export interface ChatSheetProps extends Omit<UseChatPanelChromeModelInput, 'embedAsPage'> {
|
|
8
10
|
title?: string;
|
|
@@ -35,6 +35,8 @@ export type UseChatPanelChromeModelResult = {
|
|
|
35
35
|
onOpenChange: (open: boolean) => void;
|
|
36
36
|
toggleOpen: () => void;
|
|
37
37
|
newChat: () => void;
|
|
38
|
+
/** New session + open panel + one-shot composer pre-fill (does not send). */
|
|
39
|
+
openNewChatWithPrefill: (prompt: string) => void;
|
|
38
40
|
chatPanelContainer: HTMLElement | null;
|
|
39
41
|
};
|
|
40
42
|
export declare function useChatPanelChromeModel({ embedAsPage, presets, scopeId, onMessage, onScriptComplete, renderMessageChart, emptyState, allowedAttachments, allowPdfAttachments, onAttachmentsDropped, slashCommandItems, onSlashItemCommand, transformSendPayload, }: UseChatPanelChromeModelInput): UseChatPanelChromeModelResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sybilion/uilib",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.53",
|
|
4
4
|
"description": "Sybilion Design System — React UI components (Webpack + Stylus)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -203,5 +203,6 @@
|
|
|
203
203
|
"webpack": "^5.75.0",
|
|
204
204
|
"webpack-cli": "^5.0.1",
|
|
205
205
|
"webpack-dev-server": "^5.2.3"
|
|
206
|
-
}
|
|
206
|
+
},
|
|
207
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
207
208
|
}
|
|
@@ -11,6 +11,8 @@ export type ChatSheetActions = {
|
|
|
11
11
|
open: () => void;
|
|
12
12
|
/** Starts a new chat session and opens the panel (same as the new-chat keyboard shortcut). */
|
|
13
13
|
openNewChat: () => void;
|
|
14
|
+
/** Starts a new chat, opens the panel, and pre-fills the composer (user sends manually). */
|
|
15
|
+
openNewChatWithPrefill: (prompt: string) => void;
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
export interface ChatSheetProps extends Omit<
|
|
@@ -74,6 +76,7 @@ export function ChatSheet({
|
|
|
74
76
|
model.newChat();
|
|
75
77
|
model.onOpenChange(true);
|
|
76
78
|
},
|
|
79
|
+
openNewChatWithPrefill: model.openNewChatWithPrefill,
|
|
77
80
|
};
|
|
78
81
|
}
|
|
79
82
|
|
|
@@ -91,6 +91,8 @@ export type UseChatPanelChromeModelResult = {
|
|
|
91
91
|
onOpenChange: (open: boolean) => void;
|
|
92
92
|
toggleOpen: () => void;
|
|
93
93
|
newChat: () => void;
|
|
94
|
+
/** New session + open panel + one-shot composer pre-fill (does not send). */
|
|
95
|
+
openNewChatWithPrefill: (prompt: string) => void;
|
|
94
96
|
chatPanelContainer: HTMLElement | null;
|
|
95
97
|
};
|
|
96
98
|
|
|
@@ -312,6 +314,21 @@ export function useChatPanelChromeModel({
|
|
|
312
314
|
|
|
313
315
|
const isEmpty = isChatEmpty(chat) && !isLoading;
|
|
314
316
|
|
|
317
|
+
const openNewChatWithPrefill = useCallback(
|
|
318
|
+
(prompt: string) => {
|
|
319
|
+
const sessionId = newChat();
|
|
320
|
+
if (sessionId == null) {
|
|
321
|
+
logger.warn('Chat prefill: sign in to use the assistant.');
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const trimmed = prompt.trim();
|
|
326
|
+
setPromptLinkPrefill(trimmed || null);
|
|
327
|
+
onOpenChange(true);
|
|
328
|
+
},
|
|
329
|
+
[newChat, onOpenChange],
|
|
330
|
+
);
|
|
331
|
+
|
|
315
332
|
/**
|
|
316
333
|
* App link: `?prompt=…` — open panel, pre-fill composer, strip param (read once on mount
|
|
317
334
|
* from `location.search`). If the selected session already has messages, `newChat()` first.
|
|
@@ -606,6 +623,8 @@ export function useChatPanelChromeModel({
|
|
|
606
623
|
}
|
|
607
624
|
}
|
|
608
625
|
|
|
626
|
+
setPromptLinkPrefill(null);
|
|
627
|
+
|
|
609
628
|
try {
|
|
610
629
|
if (chatId) endLocalDemoFlow(chatId);
|
|
611
630
|
let payload = buildChatSendMessagePayload(message, stagedAttachments);
|
|
@@ -1044,6 +1063,7 @@ export function useChatPanelChromeModel({
|
|
|
1044
1063
|
onOpenChange,
|
|
1045
1064
|
toggleOpen,
|
|
1046
1065
|
newChat,
|
|
1066
|
+
openNewChatWithPrefill,
|
|
1047
1067
|
chatPanelContainer,
|
|
1048
1068
|
};
|
|
1049
1069
|
}
|