@vezham/react 26.1.0 → 26.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/lib/components/command/command-dialog.js +1 -1
- package/dist/lib/components/command/command-provider.js +1 -1
- package/dist/lib/components/command/index.d.ts +0 -1
- package/dist/lib/components/command/index.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/control-center/control-center.js +1 -1
- package/dist/lib/components/panel/footer/control-center/editor.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/control-center/editor.js +19 -24
- package/dist/lib/components/panel/footer/control-center/theme.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/control-center/theme.js +2 -15
- package/dist/lib/components/panel/footer/control-center/variant.d.ts +3 -3
- package/dist/lib/components/panel/footer/control-center/variant.js +1 -1
- package/dist/lib/components/panel/footer/data.d.ts +1 -1
- package/dist/lib/components/panel/footer/data.js +1 -1
- package/dist/lib/components/panel/footer/index.d.ts +1 -1
- package/dist/lib/components/panel/footer/index.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/index.js +10 -8
- package/dist/lib/components/panel/footer/notification-center/index.js +1 -1
- package/dist/lib/components/panel/footer/tamizhi/index.d.ts +3 -0
- package/dist/lib/components/panel/footer/tamizhi/index.d.ts.map +1 -0
- package/dist/lib/components/panel/footer/tamizhi/index.js +20 -0
- package/dist/lib/components/panel/footer/types.d.ts +1 -3
- package/dist/lib/components/panel/footer/types.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/user-menu.d.ts +2 -2
- package/dist/lib/components/panel/footer/user-menu.d.ts.map +1 -1
- package/dist/lib/components/panel/footer/user-menu.js +127 -59
- package/dist/lib/components/panel/header/bookmarks/favorites/variant.js +2 -2
- package/dist/lib/components/panel/header/bookmarks/folder-modal/index.js +6 -6
- package/dist/lib/components/panel/header/bookmarks/index.js +1 -1
- package/dist/lib/components/panel/header/bookmarks/quick-access/index.js +9 -9
- package/dist/lib/components/panel/header/bookmarks/variant.js +22 -22
- package/dist/lib/components/panel/header/index.js +3 -3
- package/dist/lib/components/panel/info-panel/provider.d.ts.map +1 -1
- package/dist/lib/components/panel/info-panel/provider.js +20 -34
- package/dist/lib/components/panel/info-panel/types.d.ts +1 -1
- package/dist/lib/components/panel/info-panel/types.d.ts.map +1 -1
- package/dist/lib/components/panel/menu/index.js +4 -4
- package/dist/lib/components/panel/menu/variant.js +4 -4
- package/dist/lib/components/workspace-navigation/index.d.ts.map +1 -1
- package/dist/lib/components/workspace-navigation/index.js +1 -1
- package/dist/lib/layouts/app/index.d.ts +6 -3
- package/dist/lib/layouts/app/index.d.ts.map +1 -1
- package/dist/lib/layouts/app/index.js +36 -6
- package/dist/lib/layouts/menu-layout/home-navigation-bubble.js +3 -3
- package/dist/lib/layouts/menu-layout/index-md.d.ts.map +1 -1
- package/dist/lib/layouts/menu-layout/index-md.js +13 -27
- package/dist/lib/layouts/menu-layout/index-sm.d.ts.map +1 -1
- package/dist/lib/layouts/menu-layout/index-sm.js +7 -19
- package/dist/lib/layouts/section/toolbar.js +1 -1
- package/dist/lib/pages/settings/settings-content.d.ts.map +1 -1
- package/dist/lib/pages/settings/settings-content.js +14 -26
- package/dist/lib/workspace/action-dialog.d.ts +9 -0
- package/dist/lib/workspace/action-dialog.d.ts.map +1 -0
- package/dist/lib/workspace/action-dialog.js +86 -0
- package/dist/lib/workspace/actions-menu.d.ts +8 -0
- package/dist/lib/workspace/actions-menu.d.ts.map +1 -0
- package/dist/lib/workspace/actions-menu.js +47 -0
- package/dist/lib/workspace/create-dialog.d.ts +5 -0
- package/dist/lib/workspace/create-dialog.d.ts.map +1 -0
- package/dist/lib/workspace/create-dialog.js +108 -0
- package/dist/lib/workspace/index.d.ts +34 -0
- package/dist/lib/workspace/index.d.ts.map +1 -0
- package/dist/lib/workspace/index.js +128 -0
- package/dist/lib/workspace/menu.d.ts +18 -0
- package/dist/lib/workspace/menu.d.ts.map +1 -0
- package/dist/lib/workspace/menu.js +148 -0
- package/dist/lib/workspace/model.d.ts +17 -0
- package/dist/lib/workspace/model.d.ts.map +1 -0
- package/dist/lib/workspace/model.js +35 -0
- package/package.json +3 -2
- package/dist/lib/components/command/index.js +0 -3
- package/dist/lib/components/panel/footer/ai/chat-header.d.ts +0 -9
- package/dist/lib/components/panel/footer/ai/chat-header.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/ai/chat-header.js +0 -63
- package/dist/lib/components/panel/footer/ai/composer.d.ts +0 -7
- package/dist/lib/components/panel/footer/ai/composer.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/ai/composer.js +0 -77
- package/dist/lib/components/panel/footer/ai/content.d.ts +0 -13
- package/dist/lib/components/panel/footer/ai/content.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/ai/content.js +0 -148
- package/dist/lib/components/panel/footer/ai/conversation.d.ts +0 -47
- package/dist/lib/components/panel/footer/ai/conversation.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/ai/conversation.js +0 -222
- package/dist/lib/components/panel/footer/ai/index.d.ts +0 -3
- package/dist/lib/components/panel/footer/ai/index.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/ai/index.js +0 -41
- package/dist/lib/components/panel/footer/ai/message-actions.d.ts +0 -8
- package/dist/lib/components/panel/footer/ai/message-actions.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/ai/message-actions.js +0 -63
- package/dist/lib/components/panel/footer/ai/mock-result.d.ts +0 -6
- package/dist/lib/components/panel/footer/ai/mock-result.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/ai/mock-result.js +0 -121
- package/dist/lib/components/panel/footer/ai/model-logo.d.ts +0 -5
- package/dist/lib/components/panel/footer/ai/model-logo.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/ai/model-logo.js +0 -13
- package/dist/lib/components/panel/footer/ai/model-logos.d.ts +0 -2
- package/dist/lib/components/panel/footer/ai/model-logos.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/ai/model-logos.js +0 -10
- package/dist/lib/components/panel/footer/ai/model-picker.d.ts +0 -8
- package/dist/lib/components/panel/footer/ai/model-picker.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/ai/model-picker.js +0 -166
- package/dist/lib/components/panel/footer/ai/models.d.ts +0 -9
- package/dist/lib/components/panel/footer/ai/models.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/ai/models.js +0 -72
- package/dist/lib/components/panel/footer/ai/permission-picker.d.ts +0 -5
- package/dist/lib/components/panel/footer/ai/permission-picker.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/ai/permission-picker.js +0 -63
- package/dist/lib/components/panel/footer/ai/use-chat-scroll.d.ts +0 -9
- package/dist/lib/components/panel/footer/ai/use-chat-scroll.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/ai/use-chat-scroll.js +0 -57
- package/dist/lib/components/panel/footer/preferences/data.d.ts +0 -14
- package/dist/lib/components/panel/footer/preferences/data.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/preferences/data.js +0 -304
- package/dist/lib/components/panel/footer/preferences/modal.d.ts +0 -8
- package/dist/lib/components/panel/footer/preferences/modal.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/preferences/modal.js +0 -75
- package/dist/lib/components/panel/footer/preferences/sidebar.d.ts +0 -9
- package/dist/lib/components/panel/footer/preferences/sidebar.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/preferences/sidebar.js +0 -105
- package/dist/lib/components/panel/footer/preferences/user-settings/account/index.d.ts +0 -3
- package/dist/lib/components/panel/footer/preferences/user-settings/account/index.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/preferences/user-settings/account/index.js +0 -16
- package/dist/lib/components/panel/footer/preferences/user-settings/content-social/index.d.ts +0 -3
- package/dist/lib/components/panel/footer/preferences/user-settings/content-social/index.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/preferences/user-settings/content-social/index.js +0 -16
- package/dist/lib/components/panel/footer/preferences/user-settings/data-privacy/index.d.ts +0 -3
- package/dist/lib/components/panel/footer/preferences/user-settings/data-privacy/index.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/preferences/user-settings/data-privacy/index.js +0 -101
- package/dist/lib/components/panel/footer/preferences/user-settings/family-center/index.d.ts +0 -3
- package/dist/lib/components/panel/footer/preferences/user-settings/family-center/index.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/preferences/user-settings/family-center/index.js +0 -24
- package/dist/lib/components/panel/footer/preferences/user-settings/profiles/index.d.ts +0 -3
- package/dist/lib/components/panel/footer/preferences/user-settings/profiles/index.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/preferences/user-settings/profiles/index.js +0 -103
- package/dist/lib/components/panel/footer/tabs.d.ts +0 -12
- package/dist/lib/components/panel/footer/tabs.d.ts.map +0 -1
- package/dist/lib/components/panel/footer/tabs.js +0 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vezham/react",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.3.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/vezham/vx-fe-pkgs.git",
|
|
@@ -109,7 +109,8 @@
|
|
|
109
109
|
],
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"@tanstack/react-hotkeys": "^0.10.0",
|
|
112
|
-
"@vezham/hooks": "26.
|
|
112
|
+
"@vezham/hooks": "26.3.2",
|
|
113
|
+
"@vezham/tamizhi-ui": "26.3.2",
|
|
113
114
|
"react-aria-components": "1.21.1"
|
|
114
115
|
}
|
|
115
116
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Conversation } from './conversation';
|
|
2
|
-
type Props = {
|
|
3
|
-
conversation: Conversation;
|
|
4
|
-
expanded?: boolean;
|
|
5
|
-
onExpand?: () => void;
|
|
6
|
-
};
|
|
7
|
-
export declare const ChatHeader: ({ conversation, expanded, onExpand }: Props) => import("react").JSX.Element;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=chat-header.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat-header.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/panel/footer/ai/chat-header.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,KAAK,KAAK,GAAG;IACX,YAAY,EAAE,YAAY,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB,CAAA;AACD,eAAO,MAAM,UAAU,GAAI,sCAAsC,KAAK,gCAmDrE,CAAA"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Button, Dropdown } from "@vezham/react-v3";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { AddCircle, AltArrowDown, Maximize, Minimize } from "@vezham/icons-react";
|
|
4
|
-
//#region src/lib/components/panel/footer/ai/chat-header.tsx
|
|
5
|
-
var ChatHeader = ({ conversation, expanded, onExpand }) => /* @__PURE__ */ jsxs("nav", {
|
|
6
|
-
"aria-label": "Chat navigation",
|
|
7
|
-
className: "flex min-w-0 shrink-0 items-center gap-1",
|
|
8
|
-
children: [
|
|
9
|
-
/* @__PURE__ */ jsxs(Dropdown, { children: [/* @__PURE__ */ jsxs(Dropdown.Trigger, {
|
|
10
|
-
"aria-label": "Choose a chat",
|
|
11
|
-
className: "button button--ghost button--sm flex w-auto min-w-0 shrink flex-row flex-nowrap items-center justify-start gap-2",
|
|
12
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
13
|
-
className: "min-w-0 truncate text-start",
|
|
14
|
-
children: conversation.title
|
|
15
|
-
}), /* @__PURE__ */ jsx(AltArrowDown, {
|
|
16
|
-
className: "shrink-0",
|
|
17
|
-
size: 14,
|
|
18
|
-
"aria-hidden": "true"
|
|
19
|
-
})]
|
|
20
|
-
}), /* @__PURE__ */ jsx(Dropdown.Popover, {
|
|
21
|
-
className: "w-72",
|
|
22
|
-
children: /* @__PURE__ */ jsx(Dropdown.Menu, {
|
|
23
|
-
"aria-label": "Recent chats",
|
|
24
|
-
onAction: (key) => conversation.openChat(String(key)),
|
|
25
|
-
children: conversation.threads.map((thread) => /* @__PURE__ */ jsx(Dropdown.Item, {
|
|
26
|
-
id: thread.id,
|
|
27
|
-
textValue: thread.title,
|
|
28
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
29
|
-
className: "min-w-0 truncate",
|
|
30
|
-
children: thread.title
|
|
31
|
-
})
|
|
32
|
-
}, thread.id))
|
|
33
|
-
})
|
|
34
|
-
})] }),
|
|
35
|
-
/* @__PURE__ */ jsx(Button, {
|
|
36
|
-
size: "sm",
|
|
37
|
-
variant: "ghost",
|
|
38
|
-
className: "shrink-0",
|
|
39
|
-
"aria-label": "New chat",
|
|
40
|
-
onPress: conversation.newChat,
|
|
41
|
-
children: /* @__PURE__ */ jsx(AddCircle, {
|
|
42
|
-
size: 18,
|
|
43
|
-
"aria-hidden": "true"
|
|
44
|
-
})
|
|
45
|
-
}),
|
|
46
|
-
onExpand && /* @__PURE__ */ jsx(Button, {
|
|
47
|
-
size: "sm",
|
|
48
|
-
variant: "ghost",
|
|
49
|
-
className: "ml-auto shrink-0",
|
|
50
|
-
"aria-label": expanded ? "Collapse assistant" : "Expand assistant",
|
|
51
|
-
onPress: onExpand,
|
|
52
|
-
children: expanded ? /* @__PURE__ */ jsx(Minimize, {
|
|
53
|
-
size: 18,
|
|
54
|
-
"aria-hidden": "true"
|
|
55
|
-
}) : /* @__PURE__ */ jsx(Maximize, {
|
|
56
|
-
size: 18,
|
|
57
|
-
"aria-hidden": "true"
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
]
|
|
61
|
-
});
|
|
62
|
-
//#endregion
|
|
63
|
-
export { ChatHeader };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"composer.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/panel/footer/ai/composer.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAIlD,KAAK,KAAK,GAAG;IAAE,YAAY,EAAE,YAAY,CAAA;CAAE,CAAA;AAC3C,eAAO,MAAM,QAAQ,GAAI,qBAAqB,KAAK,gCAuFlD,CAAA"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { FastModeToggle, ModelPicker } from "./model-picker.js";
|
|
2
|
-
import { PermissionPicker } from "./permission-picker.js";
|
|
3
|
-
import { useRef } from "react";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { AddCircle, Microphone } from "@vezham/icons-react";
|
|
6
|
-
import { ChatAttachment, PromptInput } from "@vezham/react-pro-v3";
|
|
7
|
-
//#region src/lib/components/panel/footer/ai/composer.tsx
|
|
8
|
-
var Composer = ({ conversation: c }) => {
|
|
9
|
-
const fileInput = useRef(null);
|
|
10
|
-
return /* @__PURE__ */ jsxs(PromptInput, {
|
|
11
|
-
value: c.value,
|
|
12
|
-
onValueChange: c.setValue,
|
|
13
|
-
onSubmit: () => c.submit(),
|
|
14
|
-
status: c.phase === "ready" ? "ready" : c.phase === "streaming" ? "streaming" : "submitted",
|
|
15
|
-
onStop: c.stop,
|
|
16
|
-
children: [
|
|
17
|
-
/* @__PURE__ */ jsx("input", {
|
|
18
|
-
ref: fileInput,
|
|
19
|
-
type: "file",
|
|
20
|
-
multiple: true,
|
|
21
|
-
className: "hidden",
|
|
22
|
-
"aria-label": "Attach files",
|
|
23
|
-
accept: "image/*,.pdf,.txt,.md,.csv,.json",
|
|
24
|
-
onChange: (event) => {
|
|
25
|
-
c.addFiles(Array.from(event.target.files ?? []));
|
|
26
|
-
event.target.value = "";
|
|
27
|
-
}
|
|
28
|
-
}),
|
|
29
|
-
/* @__PURE__ */ jsxs(PromptInput.Shell, { children: [
|
|
30
|
-
c.attachments.length > 0 && /* @__PURE__ */ jsx(PromptInput.Attachments, {
|
|
31
|
-
className: "flex max-h-28 flex-wrap gap-2 overflow-y-auto",
|
|
32
|
-
children: c.attachments.map((file) => /* @__PURE__ */ jsxs(ChatAttachment, {
|
|
33
|
-
name: file.name,
|
|
34
|
-
mimeType: file.mimeType,
|
|
35
|
-
size: file.size,
|
|
36
|
-
children: [/* @__PURE__ */ jsx(ChatAttachment.Preview, {}), /* @__PURE__ */ jsx(ChatAttachment.Remove, {
|
|
37
|
-
"aria-label": `Remove ${file.name}`,
|
|
38
|
-
onPress: () => c.removeAttachment(file.id)
|
|
39
|
-
})]
|
|
40
|
-
}, file.id))
|
|
41
|
-
}),
|
|
42
|
-
/* @__PURE__ */ jsx(PromptInput.Content, { children: /* @__PURE__ */ jsx(PromptInput.TextArea, {
|
|
43
|
-
"aria-label": "Ask Tamizhi",
|
|
44
|
-
placeholder: "Ask Tamizhi…"
|
|
45
|
-
}) }),
|
|
46
|
-
/* @__PURE__ */ jsxs(PromptInput.Toolbar, { children: [/* @__PURE__ */ jsxs(PromptInput.ToolbarStart, { children: [/* @__PURE__ */ jsx(PromptInput.Action, {
|
|
47
|
-
"aria-label": "Attach files",
|
|
48
|
-
tooltip: "Attach files",
|
|
49
|
-
onPress: () => fileInput.current?.click(),
|
|
50
|
-
isDisabled: c.phase !== "ready",
|
|
51
|
-
children: /* @__PURE__ */ jsx(AddCircle, {
|
|
52
|
-
size: 18,
|
|
53
|
-
"aria-hidden": "true"
|
|
54
|
-
})
|
|
55
|
-
}), /* @__PURE__ */ jsx(PromptInput.Action, {
|
|
56
|
-
"aria-label": "Try voice preview",
|
|
57
|
-
tooltip: "Dictate · simulated",
|
|
58
|
-
isDisabled: c.phase !== "ready",
|
|
59
|
-
onPress: c.listen,
|
|
60
|
-
children: /* @__PURE__ */ jsx(Microphone, {
|
|
61
|
-
size: 18,
|
|
62
|
-
"aria-hidden": "true"
|
|
63
|
-
})
|
|
64
|
-
})] }), /* @__PURE__ */ jsxs(PromptInput.ToolbarEnd, { children: [/* @__PURE__ */ jsx(ModelPicker, { conversation: c }), /* @__PURE__ */ jsx(PromptInput.Send, {
|
|
65
|
-
"aria-label": c.phase === "ready" ? "Send message" : "Stop answering",
|
|
66
|
-
isDisabled: c.phase === "ready" && !c.value.trim() && !c.attachments.length
|
|
67
|
-
})] })] })
|
|
68
|
-
] }),
|
|
69
|
-
/* @__PURE__ */ jsxs("div", {
|
|
70
|
-
className: "mt-2 flex flex-wrap gap-1",
|
|
71
|
-
children: [/* @__PURE__ */ jsx(FastModeToggle, { conversation: c }), /* @__PURE__ */ jsx(PermissionPicker, { conversation: c })]
|
|
72
|
-
})
|
|
73
|
-
]
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
//#endregion
|
|
77
|
-
export { Composer };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Conversation } from './conversation';
|
|
2
|
-
type Props = {
|
|
3
|
-
conversation: Conversation;
|
|
4
|
-
compact?: boolean;
|
|
5
|
-
panel?: boolean;
|
|
6
|
-
expanded?: boolean;
|
|
7
|
-
onExpand?: () => void;
|
|
8
|
-
greeting?: string;
|
|
9
|
-
suggestions?: readonly string[];
|
|
10
|
-
};
|
|
11
|
-
export declare const AIContent: ({ conversation: c, compact, panel, expanded, onExpand, greeting, suggestions }: Props) => import("react").JSX.Element;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=content.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/panel/footer/ai/content.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAKlD,KAAK,KAAK,GAAG;IACX,YAAY,EAAE,YAAY,CAAA;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAChC,CAAA;AACD,eAAO,MAAM,SAAS,GAAI,gFAavB,KAAK,gCA6JP,CAAA"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { ChatHeader } from "./chat-header.js";
|
|
2
|
-
import { Composer } from "./composer.js";
|
|
3
|
-
import { MessageActions } from "./message-actions.js";
|
|
4
|
-
import { MockResult } from "./mock-result.js";
|
|
5
|
-
import { useChatScroll } from "./use-chat-scroll.js";
|
|
6
|
-
import { Button } from "@vezham/react-v3";
|
|
7
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { AltArrowDown, VezhamTamizhi } from "@vezham/icons-react";
|
|
9
|
-
import { ChainOfThought, ChatAttachment, ChatConversation, ChatLoader, ChatMessage, PromptSuggestion, TextShimmer } from "@vezham/react-pro-v3";
|
|
10
|
-
//#region src/lib/components/panel/footer/ai/content.tsx
|
|
11
|
-
var AIContent = ({ conversation: c, compact = false, panel = false, expanded, onExpand, greeting = "How can Tamizhi help?", suggestions = [
|
|
12
|
-
"Plan my day",
|
|
13
|
-
"Explore my workspace",
|
|
14
|
-
"Show a workspace summary",
|
|
15
|
-
"Set my preferences"
|
|
16
|
-
] }) => {
|
|
17
|
-
const { viewportRef, contentRef, showJump, onScroll, scrollToBottom } = useChatScroll(c);
|
|
18
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
19
|
-
className: `flex min-h-0 flex-col gap-3 ${compact ? "max-h-[calc(100dvh-10rem)] overflow-hidden" : panel ? "h-full overflow-hidden" : "h-[min(65dvh,32rem)]"}`,
|
|
20
|
-
children: [
|
|
21
|
-
/* @__PURE__ */ jsx(ChatHeader, {
|
|
22
|
-
conversation: c,
|
|
23
|
-
expanded,
|
|
24
|
-
onExpand
|
|
25
|
-
}),
|
|
26
|
-
/* @__PURE__ */ jsx("p", {
|
|
27
|
-
className: "text-muted shrink-0 px-1 text-xs",
|
|
28
|
-
children: "Preview · Replies, files, voice and permissions are simulated."
|
|
29
|
-
}),
|
|
30
|
-
/* @__PURE__ */ jsxs("div", {
|
|
31
|
-
className: `relative min-h-0 flex-1 ${compact ? "max-h-[35dvh]" : ""}`,
|
|
32
|
-
children: [/* @__PURE__ */ jsx(ChatConversation, {
|
|
33
|
-
ref: viewportRef,
|
|
34
|
-
"aria-label": "Conversation with Tamizhi",
|
|
35
|
-
initial: "instant",
|
|
36
|
-
resize: "instant",
|
|
37
|
-
onScroll,
|
|
38
|
-
className: "h-full min-h-0",
|
|
39
|
-
children: /* @__PURE__ */ jsxs(ChatConversation.Content, {
|
|
40
|
-
ref: contentRef,
|
|
41
|
-
className: "min-w-0 shrink-0 grow flex-col justify-end gap-4 px-1 py-2 text-sm [&>*]:shrink-0",
|
|
42
|
-
children: [
|
|
43
|
-
c.messages.length === 0 && /* @__PURE__ */ jsxs("div", {
|
|
44
|
-
className: "py-4",
|
|
45
|
-
children: [/* @__PURE__ */ jsx("h2", {
|
|
46
|
-
className: "font-semibold",
|
|
47
|
-
children: greeting
|
|
48
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
49
|
-
className: "text-muted mt-2",
|
|
50
|
-
children: "Find your way around, plan your day, or explore a sample result."
|
|
51
|
-
})]
|
|
52
|
-
}),
|
|
53
|
-
c.messages.length === 0 && /* @__PURE__ */ jsx(PromptSuggestion, { children: /* @__PURE__ */ jsx(PromptSuggestion.Items, {
|
|
54
|
-
className: "flex flex-col gap-2",
|
|
55
|
-
children: (compact ? suggestions.slice(0, 2) : suggestions).map((prompt) => /* @__PURE__ */ jsx(PromptSuggestion.Item, {
|
|
56
|
-
isDisabled: c.phase !== "ready",
|
|
57
|
-
onPress: () => c.submit(prompt),
|
|
58
|
-
className: "text-xs",
|
|
59
|
-
children: prompt
|
|
60
|
-
}, prompt))
|
|
61
|
-
}) }),
|
|
62
|
-
(compact ? c.messages.slice(-2) : c.messages).map((message) => message.role === "user" ? /* @__PURE__ */ jsxs(ChatMessage.User, { children: [/* @__PURE__ */ jsx(ChatMessage.Bubble, { children: /* @__PURE__ */ jsx(ChatMessage.Content, {
|
|
63
|
-
className: "wrap-anywhere",
|
|
64
|
-
children: message.text
|
|
65
|
-
}) }), message.attachments?.map((file) => /* @__PURE__ */ jsx(ChatAttachment, {
|
|
66
|
-
name: file.name,
|
|
67
|
-
mimeType: file.mimeType,
|
|
68
|
-
size: file.size,
|
|
69
|
-
children: /* @__PURE__ */ jsx(ChatAttachment.Preview, {})
|
|
70
|
-
}, file.id))] }, message.id) : /* @__PURE__ */ jsx(ChatMessage.Assistant, { children: /* @__PURE__ */ jsxs(ChatMessage.Body, {
|
|
71
|
-
className: "min-w-0",
|
|
72
|
-
children: [/* @__PURE__ */ jsx(ChatMessage.Content, {
|
|
73
|
-
className: `wrap-anywhere ${compact ? "line-clamp-3" : ""}`,
|
|
74
|
-
children: message.text
|
|
75
|
-
}), c.phase === "ready" && /* @__PURE__ */ jsxs(Fragment, { children: [!compact && /* @__PURE__ */ jsx(MockResult, { prompt: c.messages.slice(0, c.messages.indexOf(message)).reverse().find((item) => item.role === "user")?.text ?? "" }), /* @__PURE__ */ jsx(MessageActions, {
|
|
76
|
-
message,
|
|
77
|
-
conversation: c
|
|
78
|
-
})] })]
|
|
79
|
-
}) }, message.id)),
|
|
80
|
-
c.phase !== "ready" && /* @__PURE__ */ jsxs("div", {
|
|
81
|
-
role: "status",
|
|
82
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
83
|
-
className: "flex items-center gap-3 py-2",
|
|
84
|
-
children: [/* @__PURE__ */ jsx(ChatLoader.Pulse, { "aria-hidden": "true" }), /* @__PURE__ */ jsx(TextShimmer, { children: c.phase === "listening" ? "Listening to a sample prompt…" : c.phase === "streaming" ? "Writing response…" : "Working on your request…" })]
|
|
85
|
-
}), /* @__PURE__ */ jsxs(ChainOfThought, {
|
|
86
|
-
isStreaming: true,
|
|
87
|
-
children: [/* @__PURE__ */ jsx(ChainOfThought.Trigger, { children: "Preview progress" }), /* @__PURE__ */ jsx(ChainOfThought.Content, { children: /* @__PURE__ */ jsxs(ChainOfThought.Steps, { children: [/* @__PURE__ */ jsx(ChainOfThought.Step, {
|
|
88
|
-
label: "Read the prompt",
|
|
89
|
-
children: "Using this mock conversation and attached file names."
|
|
90
|
-
}), /* @__PURE__ */ jsxs(ChainOfThought.Step, {
|
|
91
|
-
label: "Prepare a sample result",
|
|
92
|
-
children: [
|
|
93
|
-
"Generating a simulated response with the ",
|
|
94
|
-
c.model,
|
|
95
|
-
" ",
|
|
96
|
-
"preset."
|
|
97
|
-
]
|
|
98
|
-
})] }) })]
|
|
99
|
-
})]
|
|
100
|
-
})
|
|
101
|
-
]
|
|
102
|
-
})
|
|
103
|
-
}, c.activeId), showJump && /* @__PURE__ */ jsx("div", {
|
|
104
|
-
className: "pointer-events-none absolute inset-x-0 bottom-4 flex justify-center",
|
|
105
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
106
|
-
"aria-label": "Latest messages",
|
|
107
|
-
isIconOnly: true,
|
|
108
|
-
size: "sm",
|
|
109
|
-
variant: "secondary",
|
|
110
|
-
className: "pointer-events-auto shadow-sm",
|
|
111
|
-
onPress: scrollToBottom,
|
|
112
|
-
children: /* @__PURE__ */ jsx(AltArrowDown, {
|
|
113
|
-
size: 18,
|
|
114
|
-
"aria-hidden": "true"
|
|
115
|
-
})
|
|
116
|
-
})
|
|
117
|
-
})]
|
|
118
|
-
}),
|
|
119
|
-
/* @__PURE__ */ jsxs("footer", {
|
|
120
|
-
"aria-label": "Chat composer",
|
|
121
|
-
className: "flex shrink-0 flex-col gap-3",
|
|
122
|
-
children: [/* @__PURE__ */ jsx(Composer, { conversation: c }), /* @__PURE__ */ jsxs("div", {
|
|
123
|
-
className: "text-muted flex flex-col items-center gap-1 text-center text-xs",
|
|
124
|
-
children: [/* @__PURE__ */ jsx("p", { children: "AI may make mistakes. Verify all outputs." }), /* @__PURE__ */ jsxs("a", {
|
|
125
|
-
href: "https://vezham.com/tamizhi",
|
|
126
|
-
target: "_blank",
|
|
127
|
-
rel: "noopener noreferrer",
|
|
128
|
-
className: "hover:text-foreground inline-flex items-center gap-1",
|
|
129
|
-
children: [
|
|
130
|
-
"Powered by ",
|
|
131
|
-
/* @__PURE__ */ jsx(VezhamTamizhi, {
|
|
132
|
-
size: 16,
|
|
133
|
-
"aria-hidden": "true"
|
|
134
|
-
}),
|
|
135
|
-
" ",
|
|
136
|
-
/* @__PURE__ */ jsx("span", {
|
|
137
|
-
className: "font-medium",
|
|
138
|
-
children: "Tamizhi"
|
|
139
|
-
})
|
|
140
|
-
]
|
|
141
|
-
})]
|
|
142
|
-
})]
|
|
143
|
-
})
|
|
144
|
-
]
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
//#endregion
|
|
148
|
-
export { AIContent };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
type Attachment = {
|
|
2
|
-
id: number;
|
|
3
|
-
name: string;
|
|
4
|
-
mimeType: string;
|
|
5
|
-
size: number;
|
|
6
|
-
};
|
|
7
|
-
type Message = {
|
|
8
|
-
id: number;
|
|
9
|
-
role: 'user' | 'assistant';
|
|
10
|
-
text: string;
|
|
11
|
-
attachments?: Attachment[];
|
|
12
|
-
rating?: 'up' | 'down';
|
|
13
|
-
};
|
|
14
|
-
type Phase = 'ready' | 'listening' | 'thinking' | 'streaming';
|
|
15
|
-
export declare const useMockConversation: () => {
|
|
16
|
-
attachments: Attachment[];
|
|
17
|
-
addFiles: (files: File[]) => void;
|
|
18
|
-
removeAttachment: (id: number) => void;
|
|
19
|
-
model: string;
|
|
20
|
-
setModel: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
21
|
-
fastMode: boolean;
|
|
22
|
-
setFastMode: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
23
|
-
permissions: string;
|
|
24
|
-
setPermissions: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
25
|
-
regenerate: (id: number) => void;
|
|
26
|
-
branchChat: (id: number) => void;
|
|
27
|
-
rate: (id: number, rating: "up" | "down") => void;
|
|
28
|
-
messages: Message[];
|
|
29
|
-
value: string;
|
|
30
|
-
setValue: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
31
|
-
phase: Phase;
|
|
32
|
-
submit: (prompt?: string) => void;
|
|
33
|
-
listen: () => void;
|
|
34
|
-
stop: () => void;
|
|
35
|
-
newChat: () => void;
|
|
36
|
-
openChat: (id: string) => void;
|
|
37
|
-
activeId: string;
|
|
38
|
-
title: string;
|
|
39
|
-
threads: {
|
|
40
|
-
id: string;
|
|
41
|
-
title: string;
|
|
42
|
-
preview: string;
|
|
43
|
-
}[];
|
|
44
|
-
};
|
|
45
|
-
export type Conversation = ReturnType<typeof useMockConversation>;
|
|
46
|
-
export {};
|
|
47
|
-
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/panel/footer/ai/conversation.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AACD,KAAK,OAAO,GAAG;IACb,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;IAC1B,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;CACvB,CAAA;AAED,KAAK,KAAK,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,CAAA;AAqB7D,eAAO,MAAM,mBAAmB;;sBAiML,IAAI,EAAE;2BAaN,MAAM;;;;;;;qBAjCP,MAAM;qBAnBN,MAAM;eA4BZ,MAAM,UAAU,IAAI,GAAG,MAAM;;;;;;;;;mBApCzB,MAAM;;;;;;;;CAwF7B,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
-
//#region src/lib/components/panel/footer/ai/conversation.ts
|
|
3
|
-
var initialMessages = [{
|
|
4
|
-
id: 0,
|
|
5
|
-
role: "user",
|
|
6
|
-
text: "What can you help me with?"
|
|
7
|
-
}, {
|
|
8
|
-
id: 1,
|
|
9
|
-
role: "assistant",
|
|
10
|
-
text: "Hi, I’m Tamizhi. I can help you find your way around your workspace, plan your day, or turn notes into a summary. What would you like to do?"
|
|
11
|
-
}];
|
|
12
|
-
var replyTo = (prompt) => {
|
|
13
|
-
if (/day|plan|schedule/i.test(prompt)) return "Start with your most important task, leave time for meetings, and finish with a short review. Share your priorities and we can build a simple plan together.";
|
|
14
|
-
if (/workspace|find|search/i.test(prompt)) return "Try Search to find a page, Bookmarks for saved destinations, or Storage for your files. In this preview I can explain these controls; I haven’t opened or changed anything.";
|
|
15
|
-
if (/summary|summarize|notes/i.test(prompt)) return "Paste your notes here and I’ll show a sample summary organized into key points, decisions, and next steps. This preview uses simulated replies.";
|
|
16
|
-
return "Let’s break that into a clear next step. You can ask me to plan your day, explore your workspace, or summarize notes. This is a sample reply for the assistant preview.";
|
|
17
|
-
};
|
|
18
|
-
var useMockConversation = () => {
|
|
19
|
-
const [threads, setThreads] = useState([
|
|
20
|
-
{
|
|
21
|
-
id: "welcome",
|
|
22
|
-
title: "New chat",
|
|
23
|
-
messages: []
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
id: "intro",
|
|
27
|
-
title: "Getting started",
|
|
28
|
-
messages: initialMessages
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: "planning",
|
|
32
|
-
title: "Planning my day",
|
|
33
|
-
messages: [{
|
|
34
|
-
id: 10,
|
|
35
|
-
role: "user",
|
|
36
|
-
text: "Help me plan my day"
|
|
37
|
-
}, {
|
|
38
|
-
id: 11,
|
|
39
|
-
role: "assistant",
|
|
40
|
-
text: replyTo("Plan my day")
|
|
41
|
-
}]
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: "workspace",
|
|
45
|
-
title: "Exploring my workspace",
|
|
46
|
-
messages: [{
|
|
47
|
-
id: 20,
|
|
48
|
-
role: "user",
|
|
49
|
-
text: "Where can I find my files?"
|
|
50
|
-
}, {
|
|
51
|
-
id: 21,
|
|
52
|
-
role: "assistant",
|
|
53
|
-
text: replyTo("Explore workspace")
|
|
54
|
-
}]
|
|
55
|
-
}
|
|
56
|
-
]);
|
|
57
|
-
const [activeId, setActiveId] = useState("welcome");
|
|
58
|
-
const activeThread = threads.find((thread) => thread.id === activeId);
|
|
59
|
-
const messages = activeThread?.messages ?? [];
|
|
60
|
-
const setMessages = (update) => {
|
|
61
|
-
setThreads((current) => current.map((thread) => thread.id === activeId ? {
|
|
62
|
-
...thread,
|
|
63
|
-
messages: update(thread.messages)
|
|
64
|
-
} : thread));
|
|
65
|
-
};
|
|
66
|
-
const [value, setValue] = useState("");
|
|
67
|
-
const [attachments, setAttachments] = useState([]);
|
|
68
|
-
const [model, setModel] = useState("Auto");
|
|
69
|
-
const [fastMode, setFastMode] = useState(false);
|
|
70
|
-
const [permissions, setPermissions] = useState("Ask for approval");
|
|
71
|
-
const [phase, setPhase] = useState("ready");
|
|
72
|
-
const timer = useRef(null);
|
|
73
|
-
const nextId = useRef(22);
|
|
74
|
-
const nextThreadId = useRef(1);
|
|
75
|
-
const stop = useCallback(() => {
|
|
76
|
-
if (timer.current !== null) clearTimeout(timer.current);
|
|
77
|
-
timer.current = null;
|
|
78
|
-
setPhase("ready");
|
|
79
|
-
}, []);
|
|
80
|
-
useEffect(() => () => {
|
|
81
|
-
if (timer.current !== null) clearTimeout(timer.current);
|
|
82
|
-
}, []);
|
|
83
|
-
const respond = (prompt, regenerateId) => {
|
|
84
|
-
const responseIndex = messages.findIndex((message) => message.id === regenerateId);
|
|
85
|
-
const userMessage = {
|
|
86
|
-
id: nextId.current++,
|
|
87
|
-
role: "user",
|
|
88
|
-
text: prompt,
|
|
89
|
-
attachments
|
|
90
|
-
};
|
|
91
|
-
setThreads((current) => current.map((thread) => thread.id === activeId ? {
|
|
92
|
-
...thread,
|
|
93
|
-
title: thread.messages.length === 0 ? prompt.slice(0, 48) : thread.title,
|
|
94
|
-
messages: regenerateId === void 0 ? [...thread.messages, userMessage] : thread.messages.filter((message) => message.id !== regenerateId)
|
|
95
|
-
} : thread));
|
|
96
|
-
setValue("");
|
|
97
|
-
setAttachments([]);
|
|
98
|
-
setPhase("thinking");
|
|
99
|
-
timer.current = setTimeout(() => {
|
|
100
|
-
const id = nextId.current++;
|
|
101
|
-
const fullText = replyTo(prompt);
|
|
102
|
-
let length = 0;
|
|
103
|
-
setMessages((current) => {
|
|
104
|
-
const updated = [...current];
|
|
105
|
-
updated.splice(responseIndex < 0 ? updated.length : responseIndex, 0, {
|
|
106
|
-
id,
|
|
107
|
-
role: "assistant",
|
|
108
|
-
text: ""
|
|
109
|
-
});
|
|
110
|
-
return updated;
|
|
111
|
-
});
|
|
112
|
-
setPhase("streaming");
|
|
113
|
-
const stream = () => {
|
|
114
|
-
length = Math.min(length + 28, fullText.length);
|
|
115
|
-
setMessages((current) => current.map((message) => message.id === id ? {
|
|
116
|
-
...message,
|
|
117
|
-
text: fullText.slice(0, length)
|
|
118
|
-
} : message));
|
|
119
|
-
if (length < fullText.length) timer.current = setTimeout(stream, 50);
|
|
120
|
-
else {
|
|
121
|
-
timer.current = null;
|
|
122
|
-
setPhase("ready");
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
stream();
|
|
126
|
-
}, 900);
|
|
127
|
-
};
|
|
128
|
-
const submit = (prompt = value) => {
|
|
129
|
-
if (phase !== "ready" || !prompt.trim() && attachments.length === 0) return;
|
|
130
|
-
respond(prompt.trim() || "Summarize the attached files");
|
|
131
|
-
};
|
|
132
|
-
const listen = () => {
|
|
133
|
-
if (phase !== "ready") return;
|
|
134
|
-
setPhase("listening");
|
|
135
|
-
timer.current = setTimeout(() => respond("Help me plan my day"), 1400);
|
|
136
|
-
};
|
|
137
|
-
const newChat = () => {
|
|
138
|
-
stop();
|
|
139
|
-
const thread = {
|
|
140
|
-
id: `chat-${nextThreadId.current++}`,
|
|
141
|
-
title: "New chat",
|
|
142
|
-
messages: []
|
|
143
|
-
};
|
|
144
|
-
setThreads((current) => [thread, ...current]);
|
|
145
|
-
setActiveId(thread.id);
|
|
146
|
-
setValue("");
|
|
147
|
-
setAttachments([]);
|
|
148
|
-
};
|
|
149
|
-
const openChat = (id) => {
|
|
150
|
-
if (!threads.some((thread) => thread.id === id)) return;
|
|
151
|
-
stop();
|
|
152
|
-
setActiveId(id);
|
|
153
|
-
setValue("");
|
|
154
|
-
setAttachments([]);
|
|
155
|
-
};
|
|
156
|
-
const branchChat = (id) => {
|
|
157
|
-
const index = messages.findIndex((message) => message.id === id);
|
|
158
|
-
if (phase !== "ready" || index < 0) return;
|
|
159
|
-
stop();
|
|
160
|
-
const thread = {
|
|
161
|
-
id: `chat-${nextThreadId.current++}`,
|
|
162
|
-
title: `${activeThread?.title ?? "Chat"} · Branch`,
|
|
163
|
-
messages: messages.slice(0, index + 1).map((message) => ({
|
|
164
|
-
...message,
|
|
165
|
-
id: nextId.current++,
|
|
166
|
-
attachments: message.attachments?.map((file) => ({ ...file }))
|
|
167
|
-
}))
|
|
168
|
-
};
|
|
169
|
-
setThreads((current) => [thread, ...current]);
|
|
170
|
-
setActiveId(thread.id);
|
|
171
|
-
setValue("");
|
|
172
|
-
setAttachments([]);
|
|
173
|
-
};
|
|
174
|
-
const regenerate = (id) => {
|
|
175
|
-
if (phase !== "ready") return;
|
|
176
|
-
const index = messages.findIndex((message) => message.id === id);
|
|
177
|
-
const prompt = messages.slice(0, index).reverse().find((message) => message.role === "user")?.text;
|
|
178
|
-
if (prompt) respond(prompt, id);
|
|
179
|
-
};
|
|
180
|
-
const rate = (id, rating) => setMessages((current) => current.map((message) => message.id === id ? {
|
|
181
|
-
...message,
|
|
182
|
-
rating: message.rating === rating ? void 0 : rating
|
|
183
|
-
} : message));
|
|
184
|
-
const addFiles = (files) => setAttachments((current) => [...current, ...files.map((file) => ({
|
|
185
|
-
id: nextId.current++,
|
|
186
|
-
name: file.name,
|
|
187
|
-
mimeType: file.type,
|
|
188
|
-
size: file.size
|
|
189
|
-
}))]);
|
|
190
|
-
return {
|
|
191
|
-
attachments,
|
|
192
|
-
addFiles,
|
|
193
|
-
removeAttachment: (id) => setAttachments((current) => current.filter((file) => file.id !== id)),
|
|
194
|
-
model,
|
|
195
|
-
setModel,
|
|
196
|
-
fastMode,
|
|
197
|
-
setFastMode,
|
|
198
|
-
permissions,
|
|
199
|
-
setPermissions,
|
|
200
|
-
regenerate,
|
|
201
|
-
branchChat,
|
|
202
|
-
rate,
|
|
203
|
-
messages,
|
|
204
|
-
value,
|
|
205
|
-
setValue,
|
|
206
|
-
phase,
|
|
207
|
-
submit,
|
|
208
|
-
listen,
|
|
209
|
-
stop,
|
|
210
|
-
newChat,
|
|
211
|
-
openChat,
|
|
212
|
-
activeId,
|
|
213
|
-
title: activeThread?.title ?? "New chat",
|
|
214
|
-
threads: threads.map((thread) => ({
|
|
215
|
-
id: thread.id,
|
|
216
|
-
title: thread.title,
|
|
217
|
-
preview: thread.messages.at(-1)?.text ?? "Start a conversation"
|
|
218
|
-
}))
|
|
219
|
-
};
|
|
220
|
-
};
|
|
221
|
-
//#endregion
|
|
222
|
-
export { useMockConversation };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/components/panel/footer/ai/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AA8B3D,eAAO,MAAM,OAAO,EAAE,mBAQrB,CAAA"}
|