@sybilion/uilib 1.4.32 → 1.4.33
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/src/components/ui/Card/Card.js +7 -5
- package/dist/esm/src/components/ui/Card/Card.styl.js +2 -2
- package/dist/esm/src/contexts/chat-context.js +19 -2
- package/dist/esm/types/src/components/ui/Card/Card.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Card/Card.types.d.ts +5 -2
- package/dist/esm/types/src/contexts/chat-context.d.ts +9 -2
- package/package.json +1 -1
- package/src/components/ui/Card/Card.styl +7 -1
- package/src/components/ui/Card/Card.styl.d.ts +2 -0
- package/src/components/ui/Card/Card.tsx +14 -9
- package/src/components/ui/Card/Card.types.ts +6 -2
- package/src/contexts/chat-context.tsx +35 -2
- package/src/docs/pages/CardPage.tsx +6 -6
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import cn from 'classnames';
|
|
2
3
|
import { useRef, useEffect } from 'react';
|
|
3
|
-
import S from './Card.styl.js';
|
|
4
|
-
import { Scroll } from '@homecode/ui';
|
|
5
4
|
import { TextWithDeferTooltip } from '../TextWithDeferTooltip/TextWithDeferTooltip.js';
|
|
6
|
-
import
|
|
5
|
+
import { Scroll } from '@homecode/ui';
|
|
6
|
+
import S from './Card.styl.js';
|
|
7
7
|
|
|
8
8
|
const SCROLL_OFFSET = 300;
|
|
9
|
-
function Card({ className, paddingSize
|
|
10
|
-
|
|
9
|
+
function Card({ className, size, paddingSize, radiusSize, ...props }) {
|
|
10
|
+
const resolvedPadding = paddingSize ?? size ?? 'm';
|
|
11
|
+
const resolvedRadius = radiusSize ?? size ?? 'm';
|
|
12
|
+
return (jsx("div", { className: cn(S.root, S[`padding-${resolvedPadding}`], S[`radius-${resolvedRadius}`], className), ...props }));
|
|
11
13
|
}
|
|
12
14
|
function LinkCard({ className, ...props }) {
|
|
13
15
|
return (jsx("a", { target: "_blank", rel: "noopener noreferrer", "data-slot": "link-card", className: cn(S.root, className), ...props }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.Card_root__8q1qb{background-color:var(--card);border:1px solid var(--border);border-radius:var(--radius-card);box-shadow:var(--shadow-1);color:var(--card-foreground);display:flex;flex-direction:column;
|
|
4
|
-
var S = {"root":"Card_root__8q1qb","padding-s":"Card_padding-s__lpLdw","padding-m":"Card_padding-m__TvrUr","padding-l":"Card_padding-l__lRXKf","radius-s":"Card_radius-s__gfnoW","radius-m":"Card_radius-m__DspuG","radius-l":"Card_radius-l__3WwF3","radius-xl":"Card_radius-xl__dji47","radius-2xl":"Card_radius-2xl__ED-O9","header":"Card_header__5P3LR","icon":"Card_icon__-gwqq","withBackground":"Card_withBackground__v0pKJ","headerText":"Card_headerText__GEqp9","scroll":"Card_scroll__iUPCa","centered":"Card_centered__BIpG2","fullHeight":"Card_fullHeight__EU9J4","title":"Card_title__wDAJw","description":"Card_description__gjvqz","action":"Card_action__Y2YHY","footer":"Card_footer__T0BW7"};
|
|
3
|
+
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.Card_root__8q1qb{background-color:var(--card);border:1px solid var(--border);border-radius:var(--radius-card);box-shadow:var(--shadow-1);color:var(--card-foreground);display:flex;flex-direction:column;max-height:100%;position:relative}.Card_root__8q1qb.Card_padding-xs__zTaEl{padding:var(--p-2)}.Card_root__8q1qb.Card_padding-s__lpLdw{gap:var(--p-1);padding:var(--p-4)}.Card_root__8q1qb.Card_padding-m__TvrUr{gap:var(--p-2);padding:var(--p-6)}.Card_root__8q1qb.Card_padding-l__lRXKf{gap:var(--p-3);padding:var(--p-8)}.Card_root__8q1qb.Card_radius-xs__B1bbW{border-radius:var(--p-1)}.Card_root__8q1qb.Card_radius-s__gfnoW{border-radius:var(--p-2)}.Card_root__8q1qb.Card_radius-m__DspuG{border-radius:var(--p-3)}.Card_root__8q1qb.Card_radius-l__3WwF3{border-radius:var(--p-4)}.Card_root__8q1qb.Card_radius-xl__dji47{border-radius:var(--p-5)}.Card_root__8q1qb.Card_radius-2xl__ED-O9{border-radius:var(--p-6)}.Card_header__5P3LR{align-items:flex-start;display:flex;font-size:var(--text-base);gap:var(--p-4);justify-content:space-between}.Card_header__5P3LR:has([data-slot=card-action]){grid-template-columns:1fr auto}.Card_icon__-gwqq{align-items:center;border-radius:calc(var(--p-4) - 2px);box-shadow:inset 0 0 0 1px var(--border);display:flex;flex-shrink:0;height:var(--p-12);justify-content:center;width:var(--p-12)}.Card_icon__-gwqq.Card_withBackground__v0pKJ{background:var(--page-color);box-shadow:none}.Card_icon__-gwqq>img,.Card_icon__-gwqq>svg{height:var(--p-5);width:var(--p-5)}.Card_headerText__GEqp9{flex-grow:1;overflow:hidden;width:100%}.Card_scroll__iUPCa{max-height:100%;overflow:hidden;padding-right:var(--p-6);width:calc(100% + var(--p-6))}.Card_scroll__iUPCa [data-slot=card-content]{padding-right:1px}.Card_centered__BIpG2,.Card_fullHeight__EU9J4{display:flex;flex-direction:column}.Card_centered__BIpG2{align-items:center;justify-content:center}.Card_fullHeight__EU9J4{flex-grow:1}.Card_description__gjvqz,.Card_title__wDAJw{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.Card_title__wDAJw{font-size:var(--text-lg);font-weight:500;line-height:var(--p-7);overflow:hidden}.Card_description__gjvqz{color:var(--muted-foreground);font-size:var(--text-sm);max-width:100%;word-break:break-word}.Card_action__Y2YHY{grid-column-start:2;grid-row-span:2;align-self:start;grid-row-start:1;justify-self:end}.Card_footer__T0BW7{align-items:center;display:flex;flex-shrink:0;justify-content:space-between;overflow:hidden}.Card_footer__T0BW7.border-t{padding-top:var(--p-6)}";
|
|
4
|
+
var S = {"root":"Card_root__8q1qb","padding-xs":"Card_padding-xs__zTaEl","padding-s":"Card_padding-s__lpLdw","padding-m":"Card_padding-m__TvrUr","padding-l":"Card_padding-l__lRXKf","radius-xs":"Card_radius-xs__B1bbW","radius-s":"Card_radius-s__gfnoW","radius-m":"Card_radius-m__DspuG","radius-l":"Card_radius-l__3WwF3","radius-xl":"Card_radius-xl__dji47","radius-2xl":"Card_radius-2xl__ED-O9","header":"Card_header__5P3LR","icon":"Card_icon__-gwqq","withBackground":"Card_withBackground__v0pKJ","headerText":"Card_headerText__GEqp9","scroll":"Card_scroll__iUPCa","centered":"Card_centered__BIpG2","fullHeight":"Card_fullHeight__EU9J4","title":"Card_title__wDAJw","description":"Card_description__gjvqz","action":"Card_action__Y2YHY","footer":"Card_footer__T0BW7"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { createContext, useState, useCallback, useLayoutEffect, useContext, useMemo, useEffect } from 'react';
|
|
2
|
+
import { createContext, useState, useRef, useCallback, useLayoutEffect, useContext, useMemo, useEffect } from 'react';
|
|
3
3
|
import { MessageRole } from '../components/ui/Chat/Chat.types.js';
|
|
4
4
|
import { normalizeUserTextFileAttachments } from '../components/ui/Chat/buildChatSendMessagePayload.js';
|
|
5
5
|
import { normalizeJsonDashboardChatText, stripJsonDashboardFences } from '../lib/dashboard-spec/jsonDashboardFence.js';
|
|
@@ -39,6 +39,17 @@ function remapSessionIdInMemory(prev, oldSessionId, newSessionId) {
|
|
|
39
39
|
}
|
|
40
40
|
return next;
|
|
41
41
|
}
|
|
42
|
+
/** Prior USER/ASSISTANT turns for outbound chat APIs (excludes current user line). */
|
|
43
|
+
function buildChatHistoryFromMessages(messages) {
|
|
44
|
+
const turns = messages.filter(message => !message.inProgress &&
|
|
45
|
+
(message.role === MessageRole.USER ||
|
|
46
|
+
message.role === MessageRole.ASSISTANT) &&
|
|
47
|
+
message.text.trim() !== '');
|
|
48
|
+
return turns.map(message => ({
|
|
49
|
+
role: message.role,
|
|
50
|
+
content: message.text,
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
42
53
|
/** Shallow-clone messages for seeding another session; drops in-progress rows. */
|
|
43
54
|
function cloneMessagesForNewSession(messages) {
|
|
44
55
|
return messages
|
|
@@ -67,6 +78,8 @@ function ChatProvider({ children, userSwitchKey, sendChatMessage: sendChatMessag
|
|
|
67
78
|
});
|
|
68
79
|
const [outboundPendingByKey, setOutboundPendingByKey] = useState({});
|
|
69
80
|
const [panelBusyCount, setPanelBusyCount] = useState(0);
|
|
81
|
+
const chatsRef = useRef(chats);
|
|
82
|
+
chatsRef.current = chats;
|
|
70
83
|
const acquirePanelBusy = useCallback(() => {
|
|
71
84
|
setPanelBusyCount(count => count + 1);
|
|
72
85
|
}, []);
|
|
@@ -305,6 +318,8 @@ function ChatProvider({ children, userSwitchKey, sendChatMessage: sendChatMessag
|
|
|
305
318
|
throw new Error('No chat selected');
|
|
306
319
|
}
|
|
307
320
|
const apiPayload = typeof message === 'string' ? message : message.apiMessage;
|
|
321
|
+
const priorChat = chatsRef.current[scopeId]?.find(chat => chat.session_id === targetChatId);
|
|
322
|
+
const history = buildChatHistoryFromMessages(priorChat?.messages ?? []);
|
|
308
323
|
if (typeof message === 'string') {
|
|
309
324
|
addMessage(scopeId, targetChatId, MessageRole.USER, message);
|
|
310
325
|
}
|
|
@@ -321,7 +336,9 @@ function ChatProvider({ children, userSwitchKey, sendChatMessage: sendChatMessag
|
|
|
321
336
|
beginOutboundPending(scopeId, pendingChatSessionId);
|
|
322
337
|
let effectiveSessionId = pendingChatSessionId;
|
|
323
338
|
try {
|
|
324
|
-
const data = await sendChatMessageFn(apiPayload, pendingChatSessionId
|
|
339
|
+
const data = await sendChatMessageFn(apiPayload, pendingChatSessionId, {
|
|
340
|
+
history,
|
|
341
|
+
});
|
|
325
342
|
effectiveSessionId =
|
|
326
343
|
data.session_id && data.session_id !== pendingChatSessionId
|
|
327
344
|
? data.session_id
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes, DetailedHTMLProps } from 'react';
|
|
2
2
|
import type { CardActionProps, CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardProps, CardTitleProps } from './Card.types';
|
|
3
|
-
declare function Card({ className, paddingSize, radiusSize, ...props }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function Card({ className, size, paddingSize, radiusSize, ...props }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare function LinkCard({ className, ...props }: CardProps & DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
declare function CardHeader({ className, icon, iconWithBackground, textsClassName, title, titleClassName, description, descriptionClassName, children, tooltipProps, ...props }: CardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
declare function CardTitle({ className, ...props }: CardTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { TextWithDeferTooltipProps } from '#uilib/components/ui/TextWithDeferTooltip';
|
|
2
|
+
export type CardSize = 'xs' | 's' | 'm' | 'l';
|
|
2
3
|
export interface CardProps extends React.ComponentProps<'div'> {
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
/** Shorthand for matching `paddingSize` and `radiusSize`. */
|
|
5
|
+
size?: CardSize;
|
|
6
|
+
paddingSize?: CardSize;
|
|
7
|
+
radiusSize?: CardSize | 'xl';
|
|
5
8
|
}
|
|
6
9
|
export interface CardHeaderProps extends Omit<React.ComponentProps<'div'>, 'title'> {
|
|
7
10
|
className?: string;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
import { type Chat, type ChatMeta, type ChatSendMessagePayload, type Message, MessageRole, type UserTextFileAttachment } from '#uilib/components/ui/Chat/Chat.types';
|
|
3
3
|
import type { ChatResponse } from '#uilib/types/chat-api.types';
|
|
4
4
|
import type { LinkSessionToScopeOptions } from './chatSessionStorage';
|
|
5
|
-
export type SendChatMessageFn = (message: string, targetChatId: string) => Promise<ChatResponse>;
|
|
5
|
+
export type SendChatMessageFn = (message: string, targetChatId: string, options?: SendChatMessageOptions) => Promise<ChatResponse>;
|
|
6
|
+
export type SendChatMessageOptions = {
|
|
7
|
+
/** Prior USER/ASSISTANT turns (excludes the outbound user line). */
|
|
8
|
+
history?: Array<{
|
|
9
|
+
role: string;
|
|
10
|
+
content: string;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
6
13
|
export type { ChatSendMessagePayload, UserTextFileAttachment, } from '#uilib/components/ui/Chat/Chat.types';
|
|
7
14
|
export type AddChatMessageOptions = {
|
|
8
15
|
userTextFileAttachments?: UserTextFileAttachment[];
|
package/package.json
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
.root
|
|
4
4
|
display flex
|
|
5
5
|
flex-direction column
|
|
6
|
-
gap var(--p-4)
|
|
7
6
|
max-height 100%
|
|
8
7
|
border-radius var(--radius-card)
|
|
9
8
|
border 1px solid var(--border)
|
|
@@ -12,13 +11,20 @@
|
|
|
12
11
|
color var(--card-foreground)
|
|
13
12
|
position relative
|
|
14
13
|
|
|
14
|
+
&.padding-xs
|
|
15
|
+
padding var(--p-2)
|
|
15
16
|
&.padding-s
|
|
16
17
|
padding var(--p-4)
|
|
18
|
+
gap var(--p-1)
|
|
17
19
|
&.padding-m
|
|
18
20
|
padding var(--p-6)
|
|
21
|
+
gap var(--p-2)
|
|
19
22
|
&.padding-l
|
|
20
23
|
padding var(--p-8)
|
|
24
|
+
gap var(--p-3)
|
|
21
25
|
|
|
26
|
+
&.radius-xs
|
|
27
|
+
border-radius var(--p-1)
|
|
22
28
|
&.radius-s
|
|
23
29
|
border-radius var(--p-2)
|
|
24
30
|
&.radius-m
|
|
@@ -12,11 +12,13 @@ interface CssExports {
|
|
|
12
12
|
'padding-l': string;
|
|
13
13
|
'padding-m': string;
|
|
14
14
|
'padding-s': string;
|
|
15
|
+
'padding-xs': string;
|
|
15
16
|
'radius-2xl': string;
|
|
16
17
|
'radius-l': string;
|
|
17
18
|
'radius-m': string;
|
|
18
19
|
'radius-s': string;
|
|
19
20
|
'radius-xl': string;
|
|
21
|
+
'radius-xs': string;
|
|
20
22
|
'root': string;
|
|
21
23
|
'scroll': string;
|
|
22
24
|
'title': string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
1
2
|
import {
|
|
2
3
|
AnchorHTMLAttributes,
|
|
3
4
|
DetailedHTMLProps,
|
|
@@ -5,6 +6,11 @@ import {
|
|
|
5
6
|
useEffect,
|
|
6
7
|
useRef,
|
|
7
8
|
} from 'react';
|
|
9
|
+
|
|
10
|
+
import { TextWithDeferTooltip } from '#uilib/components/ui/TextWithDeferTooltip';
|
|
11
|
+
import { Scroll } from '@homecode/ui';
|
|
12
|
+
|
|
13
|
+
import S from './Card.styl';
|
|
8
14
|
import type {
|
|
9
15
|
CardActionProps,
|
|
10
16
|
CardContentProps,
|
|
@@ -15,25 +21,24 @@ import type {
|
|
|
15
21
|
CardTitleProps,
|
|
16
22
|
} from './Card.types';
|
|
17
23
|
|
|
18
|
-
import S from './Card.styl';
|
|
19
|
-
import { Scroll } from '@homecode/ui';
|
|
20
|
-
import { TextWithDeferTooltip } from '#uilib/components/ui/TextWithDeferTooltip';
|
|
21
|
-
import cn from 'classnames';
|
|
22
|
-
|
|
23
24
|
const SCROLL_OFFSET = 300;
|
|
24
25
|
|
|
25
26
|
function Card({
|
|
26
27
|
className,
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
size,
|
|
29
|
+
paddingSize,
|
|
30
|
+
radiusSize,
|
|
29
31
|
...props
|
|
30
32
|
}: CardProps) {
|
|
33
|
+
const resolvedPadding = paddingSize ?? size ?? 'm';
|
|
34
|
+
const resolvedRadius = radiusSize ?? size ?? 'm';
|
|
35
|
+
|
|
31
36
|
return (
|
|
32
37
|
<div
|
|
33
38
|
className={cn(
|
|
34
39
|
S.root,
|
|
35
|
-
S[`padding-${
|
|
36
|
-
S[`radius-${
|
|
40
|
+
S[`padding-${resolvedPadding}`],
|
|
41
|
+
S[`radius-${resolvedRadius}`],
|
|
37
42
|
className,
|
|
38
43
|
)}
|
|
39
44
|
{...props}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { TextWithDeferTooltipProps } from '#uilib/components/ui/TextWithDeferTooltip';
|
|
2
2
|
|
|
3
|
+
export type CardSize = 'xs' | 's' | 'm' | 'l';
|
|
4
|
+
|
|
3
5
|
export interface CardProps extends React.ComponentProps<'div'> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
/** Shorthand for matching `paddingSize` and `radiusSize`. */
|
|
7
|
+
size?: CardSize;
|
|
8
|
+
paddingSize?: CardSize;
|
|
9
|
+
radiusSize?: CardSize | 'xl';
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
export interface CardHeaderProps extends Omit<
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ReactNode,
|
|
2
|
+
type ReactNode,
|
|
3
3
|
createContext,
|
|
4
4
|
useCallback,
|
|
5
5
|
useContext,
|
|
6
6
|
useEffect,
|
|
7
7
|
useLayoutEffect,
|
|
8
8
|
useMemo,
|
|
9
|
+
useRef,
|
|
9
10
|
useState,
|
|
10
11
|
} from 'react';
|
|
11
12
|
|
|
@@ -43,8 +44,14 @@ import type { LinkSessionToScopeOptions } from './chatSessionStorage';
|
|
|
43
44
|
export type SendChatMessageFn = (
|
|
44
45
|
message: string,
|
|
45
46
|
targetChatId: string,
|
|
47
|
+
options?: SendChatMessageOptions,
|
|
46
48
|
) => Promise<ChatResponse>;
|
|
47
49
|
|
|
50
|
+
export type SendChatMessageOptions = {
|
|
51
|
+
/** Prior USER/ASSISTANT turns (excludes the outbound user line). */
|
|
52
|
+
history?: Array<{ role: string; content: string }>;
|
|
53
|
+
};
|
|
54
|
+
|
|
48
55
|
export type {
|
|
49
56
|
ChatSendMessagePayload,
|
|
50
57
|
UserTextFileAttachment,
|
|
@@ -177,6 +184,23 @@ function remapSessionIdInMemory(
|
|
|
177
184
|
return next;
|
|
178
185
|
}
|
|
179
186
|
|
|
187
|
+
/** Prior USER/ASSISTANT turns for outbound chat APIs (excludes current user line). */
|
|
188
|
+
function buildChatHistoryFromMessages(
|
|
189
|
+
messages: readonly Message[],
|
|
190
|
+
): SendChatMessageOptions['history'] {
|
|
191
|
+
const turns = messages.filter(
|
|
192
|
+
message =>
|
|
193
|
+
!message.inProgress &&
|
|
194
|
+
(message.role === MessageRole.USER ||
|
|
195
|
+
message.role === MessageRole.ASSISTANT) &&
|
|
196
|
+
message.text.trim() !== '',
|
|
197
|
+
);
|
|
198
|
+
return turns.map(message => ({
|
|
199
|
+
role: message.role,
|
|
200
|
+
content: message.text,
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
|
|
180
204
|
/** Shallow-clone messages for seeding another session; drops in-progress rows. */
|
|
181
205
|
function cloneMessagesForNewSession(messages: readonly Message[]): Message[] {
|
|
182
206
|
return messages
|
|
@@ -222,6 +246,8 @@ export function ChatProvider({
|
|
|
222
246
|
Record<string, number>
|
|
223
247
|
>({});
|
|
224
248
|
const [panelBusyCount, setPanelBusyCount] = useState(0);
|
|
249
|
+
const chatsRef = useRef(chats);
|
|
250
|
+
chatsRef.current = chats;
|
|
225
251
|
|
|
226
252
|
const acquirePanelBusy = useCallback(() => {
|
|
227
253
|
setPanelBusyCount(count => count + 1);
|
|
@@ -558,6 +584,11 @@ export function ChatProvider({
|
|
|
558
584
|
const apiPayload =
|
|
559
585
|
typeof message === 'string' ? message : message.apiMessage;
|
|
560
586
|
|
|
587
|
+
const priorChat = chatsRef.current[scopeId]?.find(
|
|
588
|
+
chat => chat.session_id === targetChatId,
|
|
589
|
+
);
|
|
590
|
+
const history = buildChatHistoryFromMessages(priorChat?.messages ?? []);
|
|
591
|
+
|
|
561
592
|
if (typeof message === 'string') {
|
|
562
593
|
addMessage(scopeId, targetChatId, MessageRole.USER, message);
|
|
563
594
|
} else if (!message.omitUserMessage) {
|
|
@@ -587,7 +618,9 @@ export function ChatProvider({
|
|
|
587
618
|
beginOutboundPending(scopeId, pendingChatSessionId);
|
|
588
619
|
let effectiveSessionId = pendingChatSessionId;
|
|
589
620
|
try {
|
|
590
|
-
const data = await sendChatMessageFn(apiPayload, pendingChatSessionId
|
|
621
|
+
const data = await sendChatMessageFn(apiPayload, pendingChatSessionId, {
|
|
622
|
+
history,
|
|
623
|
+
});
|
|
591
624
|
|
|
592
625
|
effectiveSessionId =
|
|
593
626
|
data.session_id && data.session_id !== pendingChatSessionId
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Button } from '#uilib/components/ui/Button';
|
|
1
2
|
import {
|
|
2
3
|
Card,
|
|
3
4
|
CardContent,
|
|
@@ -7,17 +8,16 @@ import {
|
|
|
7
8
|
CardTitle,
|
|
8
9
|
LinkCard,
|
|
9
10
|
} from '#uilib/components/ui/Card';
|
|
11
|
+
import CardGuidance from '#uilib/components/ui/Card/AGENT.md';
|
|
12
|
+
import { PageContentSection } from '#uilib/components/ui/Page';
|
|
13
|
+
import { PackageIcon } from '@phosphor-icons/react';
|
|
10
14
|
|
|
11
15
|
import { AppPageHeader } from '../components/AppPageHeader/AppPageHeader';
|
|
12
|
-
import { Button } from '#uilib/components/ui/Button';
|
|
13
|
-
import CardGuidance from '#uilib/components/ui/Card/AGENT.md';
|
|
14
16
|
import { DocsGuidance } from '../components/DocsGuidance/DocsGuidance';
|
|
15
17
|
import { DocsHeaderActions } from '../docsHeaderActions';
|
|
16
|
-
import { PackageIcon } from '@phosphor-icons/react';
|
|
17
|
-
import { PageContentSection } from '#uilib/components/ui/Page';
|
|
18
18
|
|
|
19
|
-
const PADDING_SIZES = ['s', 'm', 'l'] as const;
|
|
20
|
-
const RADIUS_SIZES = ['s', 'm', 'l', 'xl'] as const;
|
|
19
|
+
const PADDING_SIZES = ['xs', 's', 'm', 'l'] as const;
|
|
20
|
+
const RADIUS_SIZES = ['xs', 's', 'm', 'l', 'xl'] as const;
|
|
21
21
|
|
|
22
22
|
const CARD_WIDTH = 280;
|
|
23
23
|
|