@alpaca-editor/core 1.0.4190 → 1.0.4191
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/agents-view/AgentCard.js +1 -1
- package/dist/agents-view/AgentCard.js.map +1 -1
- package/dist/agents-view/AgentsView.js +5 -7
- package/dist/agents-view/AgentsView.js.map +1 -1
- package/dist/config/config.js +14 -7
- package/dist/config/config.js.map +1 -1
- package/dist/editor/ItemInfo.js +3 -3
- package/dist/editor/ItemInfo.js.map +1 -1
- package/dist/editor/QuickItemSwitcher.js +1 -1
- package/dist/editor/QuickItemSwitcher.js.map +1 -1
- package/dist/editor/ai/AgentTerminal.d.ts +1 -7
- package/dist/editor/ai/AgentTerminal.js +382 -256
- package/dist/editor/ai/AgentTerminal.js.map +1 -1
- package/dist/editor/ai/Agents.js +84 -198
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/AiResponseMessage.d.ts +1 -3
- package/dist/editor/ai/AiResponseMessage.js +12 -63
- package/dist/editor/ai/AiResponseMessage.js.map +1 -1
- package/dist/editor/ai/ToolCallDisplay.d.ts +1 -2
- package/dist/editor/ai/ToolCallDisplay.js +5 -13
- package/dist/editor/ai/ToolCallDisplay.js.map +1 -1
- package/dist/editor/client/EditorShell.js +5 -6
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/hooks/useSocketMessageHandler.js +4 -6
- package/dist/editor/client/hooks/useSocketMessageHandler.js.map +1 -1
- package/dist/editor/commands/componentCommands.js +0 -2
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/control-center/About.js +1 -1
- package/dist/editor/control-center/About.js.map +1 -1
- package/dist/editor/control-center/AllAgentsPanel.js +1 -1
- package/dist/editor/field-types/MultiLineText.js +1 -1
- package/dist/editor/field-types/MultiLineText.js.map +1 -1
- package/dist/editor/services/aiService.d.ts +0 -1
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/editor/sidebar/Validation.js +1 -1
- package/dist/editor/sidebar/Validation.js.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/page-wizard/PageWizard.js +3 -3
- package/dist/page-wizard/PageWizard.js.map +1 -1
- package/dist/page-wizard/WizardSteps.js +1 -1
- package/dist/page-wizard/WizardSteps.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/splash-screen/OpenPage.js +6 -10
- package/dist/splash-screen/OpenPage.js.map +1 -1
- package/dist/splash-screen/RecentPages.js +2 -2
- package/dist/splash-screen/RecentPages.js.map +1 -1
- package/dist/splash-screen/SplashScreen.js +1 -1
- package/dist/splash-screen/SplashScreen.js.map +1 -1
- package/dist/styles.css +12 -241
- package/package.json +1 -1
- package/src/agents-view/AgentCard.tsx +6 -1
- package/src/agents-view/AgentsView.tsx +30 -18
- package/src/config/config.tsx +17 -8
- package/src/editor/ItemInfo.tsx +2 -3
- package/src/editor/QuickItemSwitcher.tsx +1 -1
- package/src/editor/ai/AgentTerminal.tsx +649 -544
- package/src/editor/ai/Agents.tsx +250 -464
- package/src/editor/ai/AiResponseMessage.tsx +29 -154
- package/src/editor/ai/ToolCallDisplay.tsx +4 -18
- package/src/editor/client/EditorShell.tsx +6 -9
- package/src/editor/client/hooks/useSocketMessageHandler.ts +7 -6
- package/src/editor/commands/componentCommands.tsx +0 -1
- package/src/editor/control-center/About.tsx +2 -2
- package/src/editor/control-center/AllAgentsPanel.tsx +1 -1
- package/src/editor/field-types/MultiLineText.tsx +1 -1
- package/src/editor/services/aiService.ts +0 -2
- package/src/editor/sidebar/Validation.tsx +1 -1
- package/src/index.ts +0 -5
- package/src/page-wizard/PageWizard.tsx +3 -3
- package/src/page-wizard/WizardSteps.tsx +1 -1
- package/src/revision.ts +2 -2
- package/src/splash-screen/OpenPage.tsx +4 -12
- package/src/splash-screen/RecentPages.tsx +61 -58
- package/src/splash-screen/SplashScreen.tsx +1 -1
- package/styles.css +0 -20
- package/dist/components/ui/PlaceholderInput.d.ts +0 -41
- package/dist/components/ui/PlaceholderInput.js +0 -160
- package/dist/components/ui/PlaceholderInput.js.map +0 -1
- package/dist/components/ui/PlaceholderInputTypes.d.ts +0 -41
- package/dist/components/ui/PlaceholderInputTypes.js +0 -48
- package/dist/components/ui/PlaceholderInputTypes.js.map +0 -1
- package/dist/components/ui/PlaceholderItemSelector.d.ts +0 -7
- package/dist/components/ui/PlaceholderItemSelector.js +0 -154
- package/dist/components/ui/PlaceholderItemSelector.js.map +0 -1
- package/dist/splash-screen/ModernSplashScreen.d.ts +0 -8
- package/dist/splash-screen/ModernSplashScreen.js +0 -36
- package/dist/splash-screen/ModernSplashScreen.js.map +0 -1
- package/dist/splash-screen/ParheliaAssistantChat.d.ts +0 -8
- package/dist/splash-screen/ParheliaAssistantChat.js +0 -155
- package/dist/splash-screen/ParheliaAssistantChat.js.map +0 -1
- package/dist/splash-screen/RecentAgents.d.ts +0 -7
- package/dist/splash-screen/RecentAgents.js +0 -76
- package/dist/splash-screen/RecentAgents.js.map +0 -1
- package/src/components/ui/PlaceholderInput.tsx +0 -290
- package/src/components/ui/PlaceholderInputTypes.tsx +0 -97
- package/src/components/ui/PlaceholderItemSelector.tsx +0 -253
- package/src/splash-screen/ModernSplashScreen.tsx +0 -158
- package/src/splash-screen/ParheliaAssistantChat.tsx +0 -273
- package/src/splash-screen/RecentAgents.tsx +0 -151
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlaceholderItemSelector.js","sourceRoot":"","sources":["../../../src/components/ui/PlaceholderItemSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,UAAU,EAAc,MAAM,4BAA4B,CAAC;AACpE,OAAO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;4CAC/B,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAqB,CAAC;4CAC9C,IAAI,IAAI,EAAE,CAAC;gDACT,kBAAkB,CAAC;oDACjB,EAAE,EAAE,IAAI,CAAC,EAAE;oDACX,IAAI,EAAE,IAAI,CAAC,IAAI;oDACf,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI;oDAC5B,QAAQ,EAAE,IAAI;oDACd,OAAO,EAAE,CAAC;oDACV,IAAI,EAAE,IAAI,CAAC,IAAI;iDAChB,CAAC,CAAC;4CACL,CAAC;wCACH,CAAC,EACD,QAAQ,EAAC,IAAI,GACb,GACE,CACP;6BACF;4BACD;gCACE,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,MAAM;gCACnB,OAAO,EAAE,CACP,cAAK,SAAS,EAAC,0BAA0B,YACvC,KAAC,UAAU,IACT,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,EAClD,YAAY,EAAE,kBAAkB,EAChC,QAAQ,EAAC,IAAI,EACb,SAAS,EAAE,IAAI,GACf,GACE,CACP;6BACF;yBACF,GACD,GACE,GACS,IACT,CACX,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Modern splash screen with clean design featuring:
|
|
3
|
-
* - Parhelia logo and branding
|
|
4
|
-
* - Functional AI assistant chat interface
|
|
5
|
-
* - Quick action buttons
|
|
6
|
-
* - Recent pages overview
|
|
7
|
-
*/
|
|
8
|
-
export declare function ModernSplashScreen(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { useEditContext } from "../editor/client/editContext";
|
|
5
|
-
import { AnimatedSunIcon } from "../editor/ui/Icons";
|
|
6
|
-
import { ActionButton } from "../components/ActionButton";
|
|
7
|
-
import { RecentPages } from "./RecentPages";
|
|
8
|
-
import { ParheliaAssistantChat } from "./ParheliaAssistantChat";
|
|
9
|
-
import { RecentAgents } from "./RecentAgents";
|
|
10
|
-
import { FileText, FolderOpen, ExternalLink, Bot, Layers } from "lucide-react";
|
|
11
|
-
/**
|
|
12
|
-
* Modern splash screen with clean design featuring:
|
|
13
|
-
* - Parhelia logo and branding
|
|
14
|
-
* - Functional AI assistant chat interface
|
|
15
|
-
* - Quick action buttons
|
|
16
|
-
* - Recent pages overview
|
|
17
|
-
*/
|
|
18
|
-
export function ModernSplashScreen() {
|
|
19
|
-
const editContext = useEditContext();
|
|
20
|
-
const [selectedAgent, setSelectedAgent] = useState(null);
|
|
21
|
-
const handleSelectAgent = (agent) => {
|
|
22
|
-
setSelectedAgent(agent);
|
|
23
|
-
};
|
|
24
|
-
return (_jsxs("div", { className: "relative flex h-screen w-full flex-col overflow-y-auto bg-gradient-to-br from-purple-50/30 via-pink-50/20 to-blue-50/30", children: [_jsx("div", { className: "bg-wizard absolute inset-0 opacity-20" }), _jsxs("div", { className: "relative z-10 flex flex-1 flex-col items-center px-4 py-8 md:py-12", children: [_jsxs("div", { className: "mb-8 flex flex-col items-center gap-4 md:mb-12", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(AnimatedSunIcon, {}), _jsx("h1", { className: "text-3xl font-extralight tracking-wide text-gray-900 md:text-4xl", children: "parhelia" })] }), _jsx("p", { className: "text-center text-sm text-gray-600 md:text-base", children: "Where brilliant ideas become brilliant content" })] }), _jsx("div", { className: "mb-8 w-full max-w-3xl md:mb-12", children: _jsx(ParheliaAssistantChat, { className: "w-full", externalAgent: selectedAgent }) }), _jsx("div", { className: "mb-8 w-full max-w-3xl md:mb-12", children: _jsx(RecentAgents, { onSelectAgent: handleSelectAgent }) }), _jsxs("div", { className: "mb-8 w-full max-w-5xl md:mb-12", children: [_jsx("h2", { className: "mb-4 text-center text-sm font-medium text-gray-700", children: "Quick Actions" }), _jsxs("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-4 md:gap-4", children: [_jsx(ActionCard, { icon: _jsx(FileText, { strokeWidth: 1 }), title: "Create Page", description: "Start building", onClick: () => editContext?.switchView("new-page"), dataTestId: "create-new-page-button" }), _jsx(ActionCard, { icon: _jsx(FolderOpen, { strokeWidth: 1 }), title: "Open Page", description: "Browse content", onClick: () => editContext?.switchView("open-page") }), _jsx(ActionCard, { icon: _jsx(Bot, { strokeWidth: 1 }), title: "My Agents", description: "AI assistants", onClick: () => {
|
|
25
|
-
editContext?.switchView("agents-overview");
|
|
26
|
-
editContext?.setShowAgentsPanel?.(true);
|
|
27
|
-
} }), _jsx(ActionCard, { icon: _jsx(ExternalLink, { strokeWidth: 1 }), title: "Launchpad", description: "Sitecore tools", onClick: () => {
|
|
28
|
-
window.open("/sitecore/shell/sitecore/client/Applications/Launchpad", "_blank");
|
|
29
|
-
} })] })] }), _jsx("div", { className: "w-full max-w-5xl", children: _jsx(RecentPages, {}) }), _jsx("div", { className: "mt-8 flex flex-col gap-3 md:mt-12", children: _jsxs(ActionButton, { variant: "ghost", onClick: () => {
|
|
30
|
-
editContext?.switchView("page-editor");
|
|
31
|
-
}, className: "text-gray-600 hover:text-gray-900", children: [_jsx(Layers, { strokeWidth: 1, className: "mr-2 h-4 w-4" }), "Return to editor"] }) })] })] }));
|
|
32
|
-
}
|
|
33
|
-
const ActionCard = ({ icon, title, description, onClick, dataTestId, }) => {
|
|
34
|
-
return (_jsxs("button", { onClick: onClick, "data-testid": dataTestId, className: "group flex flex-col items-center gap-3 rounded-lg bg-white p-6 shadow-sm transition-all duration-200 hover:scale-[1.02] hover:shadow-md active:scale-[0.98] md:p-8", children: [_jsx("div", { className: "flex h-12 w-12 items-center justify-center rounded-full bg-gradient-to-br from-purple-100 to-pink-100 text-purple-600 transition-colors group-hover:from-purple-500 group-hover:to-pink-500 group-hover:text-white md:h-14 md:w-14", children: icon }), _jsxs("div", { className: "flex flex-col items-center gap-1", children: [_jsx("h3", { className: "text-sm font-semibold text-gray-900 md:text-base", children: title }), _jsx("p", { className: "text-xs text-gray-500", children: description })] })] }));
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=ModernSplashScreen.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModernSplashScreen.js","sourceRoot":"","sources":["../../src/splash-screen/ModernSplashScreen.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IAEvE,MAAM,iBAAiB,GAAG,CAAC,KAAY,EAAE,EAAE;QACzC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAC,yHAAyH,aAEtI,cAAK,SAAS,EAAC,uCAAuC,GAAG,EAGzD,eAAK,SAAS,EAAC,oEAAoE,aAEjF,eAAK,SAAS,EAAC,gDAAgD,aAC7D,eAAK,SAAS,EAAC,yBAAyB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EACtC,KAAK,EAAC,WAAW,EACjB,WAAW,EAAC,gBAAgB,EAC5B,OAAO,EAAE,GAAG,EAAE;4CACZ,MAAM,CAAC,IAAI,CACT,wDAAwD,EACxD,QAAQ,CACT,CAAC;wCACJ,CAAC,GACD,IACE,IACF,EAGN,cAAK,SAAS,EAAC,kBAAkB,YAC/B,KAAC,WAAW,KAAG,GACX,EAGN,cAAK,SAAS,EAAC,mCAAmC,YAChD,MAAC,YAAY,IACX,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,GAAG,EAAE;gCACZ,WAAW,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;4BACzC,CAAC,EACD,SAAS,EAAC,mCAAmC,aAE7C,KAAC,MAAM,IAAC,WAAW,EAAE,CAAC,EAAE,SAAS,EAAC,cAAc,GAAG,wBAEtC,GACX,IACF,IACF,CACP,CAAC;AACJ,CAAC;AAaD,MAAM,UAAU,GAA8B,CAAC,EAC7C,IAAI,EACJ,KAAK,EACL,WAAW,EACX,OAAO,EACP,UAAU,GACX,EAAE,EAAE;IACH,OAAO,CACL,kBACE,OAAO,EAAE,OAAO,iBACH,UAAU,EACvB,SAAS,EAAC,oKAAoK,aAE9K,cAAK,SAAS,EAAC,oOAAoO,YAChP,IAAI,GACD,EACN,eAAK,SAAS,EAAC,kCAAkC,aAC/C,aAAI,SAAS,EAAC,kDAAkD,YAC7D,KAAK,GACH,EACL,YAAG,SAAS,EAAC,uBAAuB,YAAE,WAAW,GAAK,IAClD,IACC,CACV,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Agent } from "../editor/services/agentService";
|
|
3
|
-
interface ParheliaAssistantChatProps {
|
|
4
|
-
className?: string;
|
|
5
|
-
externalAgent?: Agent | null;
|
|
6
|
-
}
|
|
7
|
-
export declare const ParheliaAssistantChat: React.FC<ParheliaAssistantChatProps>;
|
|
8
|
-
export {};
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect, useCallback, startTransition, ViewTransition } from "react";
|
|
4
|
-
import { Loader2, RotateCcw, X } from "lucide-react";
|
|
5
|
-
import { useEditContext } from "../editor/client/editContext";
|
|
6
|
-
import { loadAiProfiles } from "../editor/services/aiService";
|
|
7
|
-
import { getActiveAgents, closeAgent } from "../editor/services/agentService";
|
|
8
|
-
import { AgentTerminal } from "../editor/ai/AgentTerminal";
|
|
9
|
-
import { cn } from "../lib/utils";
|
|
10
|
-
import { Button } from "../components/ui/button";
|
|
11
|
-
export const ParheliaAssistantChat = ({ className, externalAgent, }) => {
|
|
12
|
-
const editContext = useEditContext();
|
|
13
|
-
const [profile, setProfile] = useState(null);
|
|
14
|
-
const [profiles, setProfiles] = useState([]);
|
|
15
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
16
|
-
const [agent, setAgent] = useState(null);
|
|
17
|
-
const [agentKey, setAgentKey] = useState(0); // Force re-render of AgentTerminal
|
|
18
|
-
const [isTerminalVisible, setIsTerminalVisible] = useState(false);
|
|
19
|
-
// Create a new agent
|
|
20
|
-
const createNewAgent = useCallback((selectedProfile) => {
|
|
21
|
-
const agentDisplayName = selectedProfile.agentName || "Parhelia";
|
|
22
|
-
const agentId = crypto.randomUUID();
|
|
23
|
-
const newAgent = {
|
|
24
|
-
status: "new",
|
|
25
|
-
id: agentId,
|
|
26
|
-
name: agentDisplayName,
|
|
27
|
-
updatedDate: new Date().toISOString(),
|
|
28
|
-
userId: "",
|
|
29
|
-
profileId: selectedProfile.id,
|
|
30
|
-
profileName: selectedProfile.name,
|
|
31
|
-
};
|
|
32
|
-
setAgent(newAgent);
|
|
33
|
-
return newAgent;
|
|
34
|
-
}, []);
|
|
35
|
-
// Load AI profiles on mount
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
const loadProfile = async () => {
|
|
38
|
-
try {
|
|
39
|
-
setIsLoading(true);
|
|
40
|
-
const profileList = await loadAiProfiles();
|
|
41
|
-
// Try to find Parhelia profile with multiple strategies
|
|
42
|
-
let assistantProfile;
|
|
43
|
-
// Strategy 1: Look for exact ID match
|
|
44
|
-
assistantProfile = profileList.find((p) => p.id === "7d45ab97-f253-4915-8b32-f9e8c762c5e9");
|
|
45
|
-
// Strategy 2: Look for exact name match (case-insensitive)
|
|
46
|
-
if (!assistantProfile) {
|
|
47
|
-
assistantProfile = profileList.find((p) => p.name.toLowerCase() === "parhelia");
|
|
48
|
-
}
|
|
49
|
-
// Strategy 3: Look for profile containing "parhelia" in name or displayTitle
|
|
50
|
-
if (!assistantProfile) {
|
|
51
|
-
assistantProfile = profileList.find((p) => p.name.toLowerCase().includes("parhelia") ||
|
|
52
|
-
p.displayTitle?.toLowerCase().includes("parhelia"));
|
|
53
|
-
}
|
|
54
|
-
// Strategy 4: Fallback to first available profile
|
|
55
|
-
const selectedProfile = assistantProfile || profileList[0];
|
|
56
|
-
if (selectedProfile) {
|
|
57
|
-
setProfile(selectedProfile);
|
|
58
|
-
setProfiles(profileList);
|
|
59
|
-
// Try to find latest idle Parhelia agent
|
|
60
|
-
try {
|
|
61
|
-
const response = await getActiveAgents({ limit: 50 });
|
|
62
|
-
// Filter for Parhelia agents (by profileId) that are idle/completed
|
|
63
|
-
// Exclude agents that are "running" (1) or "waitingForApproval" (2) to avoid showing stuck dancing dots
|
|
64
|
-
const parheliaAgents = response.agents.filter((a) => a.profileId === selectedProfile.id &&
|
|
65
|
-
a.status !== "running" &&
|
|
66
|
-
a.status !== 1 &&
|
|
67
|
-
a.status !== "waitingForApproval" &&
|
|
68
|
-
a.status !== 2);
|
|
69
|
-
if (parheliaAgents.length > 0 && parheliaAgents[0]) {
|
|
70
|
-
// Use the most recent idle agent (agents are typically ordered by updatedDate)
|
|
71
|
-
const latestAgent = parheliaAgents[0];
|
|
72
|
-
setAgent(latestAgent);
|
|
73
|
-
// Show terminal immediately for existing agents
|
|
74
|
-
setIsTerminalVisible(true);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
// No existing idle agent, create new one
|
|
78
|
-
createNewAgent(selectedProfile);
|
|
79
|
-
// Terminal stays hidden for new agents
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch (err) {
|
|
83
|
-
// Failed to fetch active agents, create new one
|
|
84
|
-
createNewAgent(selectedProfile);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
catch (err) {
|
|
89
|
-
console.error("Failed to load AI profile:", err);
|
|
90
|
-
}
|
|
91
|
-
finally {
|
|
92
|
-
setIsLoading(false);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
loadProfile();
|
|
96
|
-
}, [createNewAgent]);
|
|
97
|
-
// Handle external agent selection
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
if (externalAgent) {
|
|
100
|
-
setAgent(externalAgent);
|
|
101
|
-
setAgentKey((prev) => prev + 1);
|
|
102
|
-
setIsTerminalVisible(true);
|
|
103
|
-
}
|
|
104
|
-
}, [externalAgent]);
|
|
105
|
-
// Handle revealing the terminal when user clicks into chat
|
|
106
|
-
const handleRevealTerminal = useCallback(() => {
|
|
107
|
-
startTransition(() => {
|
|
108
|
-
setIsTerminalVisible(true);
|
|
109
|
-
});
|
|
110
|
-
}, []);
|
|
111
|
-
// Handle start over
|
|
112
|
-
const handleStartOver = useCallback(async () => {
|
|
113
|
-
if (!profile || !agent)
|
|
114
|
-
return;
|
|
115
|
-
try {
|
|
116
|
-
// Close the current agent first
|
|
117
|
-
await closeAgent(agent.id);
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
console.error("Failed to close agent:", error);
|
|
121
|
-
// Continue anyway to create new agent
|
|
122
|
-
}
|
|
123
|
-
// Create new agent and force re-render
|
|
124
|
-
createNewAgent(profile);
|
|
125
|
-
setAgentKey((prev) => prev + 1);
|
|
126
|
-
// Keep terminal visible when starting over
|
|
127
|
-
}, [profile, agent, createNewAgent]);
|
|
128
|
-
// Handle close
|
|
129
|
-
const handleClose = useCallback(async () => {
|
|
130
|
-
if (!agent)
|
|
131
|
-
return;
|
|
132
|
-
try {
|
|
133
|
-
await closeAgent(agent.id);
|
|
134
|
-
}
|
|
135
|
-
catch (error) {
|
|
136
|
-
console.error("Failed to close agent:", error);
|
|
137
|
-
}
|
|
138
|
-
// Hide the terminal
|
|
139
|
-
setIsTerminalVisible(false);
|
|
140
|
-
}, [agent]);
|
|
141
|
-
if (isLoading) {
|
|
142
|
-
return (_jsx("div", { className: cn("flex items-center justify-center rounded-lg bg-white p-8 shadow-md", className), children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-gray-400" }) }));
|
|
143
|
-
}
|
|
144
|
-
if (!agent || !profile) {
|
|
145
|
-
return (_jsx("div", { className: cn("flex items-center justify-center rounded-lg bg-white p-8 shadow-md", className), children: _jsx("p", { className: "text-sm text-gray-500", children: "Assistant unavailable. Please try again later." }) }));
|
|
146
|
-
}
|
|
147
|
-
return (_jsxs("div", { onClick: handleRevealTerminal, className: cn("flex flex-col overflow-hidden rounded-lg bg-white shadow-md", !isTerminalVisible && "cursor-pointer", className), children: [_jsxs("div", { className: "flex items-center justify-between border-b border-gray-200 px-4 py-2", children: [_jsxs("div", { className: "text-sm font-medium text-gray-700", children: ["Chat with ", agent.name || profile.agentName || "Parhelia"] }), isTerminalVisible && (_jsxs("div", { className: "flex items-center gap-1", children: [_jsxs(Button, { variant: "ghost", size: "sm", onClick: handleStartOver, className: "h-7 gap-1.5 text-xs", children: [_jsx(RotateCcw, { className: "h-3.5 w-3.5", strokeWidth: 1 }), "Start Over"] }), _jsx(Button, { variant: "ghost", size: "sm", onClick: handleClose, className: "h-7 w-7 p-0", "aria-label": "Close", children: _jsx(X, { className: "h-4 w-4", strokeWidth: 1.5 }) })] }))] }), _jsx("div", { className: "flex-1 overflow-hidden", children: isTerminalVisible && (_jsx(ViewTransition, { enter: "slide-fade-in", children: _jsx("div", { className: "h-[600px]", children: _jsx(AgentTerminal, { agentStub: agent, initialMetadata: {
|
|
148
|
-
profile: profile.name,
|
|
149
|
-
additionalData: {
|
|
150
|
-
profileId: profile.id,
|
|
151
|
-
profileName: profile.name,
|
|
152
|
-
},
|
|
153
|
-
}, profiles: profiles, isActive: true, compact: true, hideContext: true, hideBottomControls: true, hideGreeting: false, className: "h-full", initialPrompt: agent.status === "new" ? "" : undefined }, agentKey) }) })) })] }));
|
|
154
|
-
};
|
|
155
|
-
//# sourceMappingURL=ParheliaAssistantChat.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ParheliaAssistantChat.js","sourceRoot":"","sources":["../../src/splash-screen/ParheliaAssistantChat.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACjG,OAAO,EAAE,OAAO,EAAE,SAAS,EAAiB,CAAC,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAa,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAS,eAAe,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAOjD,MAAM,CAAC,MAAM,qBAAqB,GAAyC,CAAC,EAC1E,SAAS,EACT,aAAa,GACd,EAAE,EAAE;IACH,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAmB,IAAI,CAAC,CAAC;IAC/D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAc,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AAI,EACxB,YAAY,EAAE,KAAK,EACnB,SAAS,EAAC,QAAQ,EAClB,aAAa,EAAE,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,IAhBjD,QAAQ,CAiBb,GACI,GACS,CAClB,GACG,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect } from "react";
|
|
4
|
-
import { MessageSquare } from "lucide-react";
|
|
5
|
-
import { loadAiProfiles } from "../editor/services/aiService";
|
|
6
|
-
import { getAgentsGrouped } from "../editor/services/agentService";
|
|
7
|
-
import { useEditContext } from "../editor/client/editContext";
|
|
8
|
-
import { Button } from "../components/ui/button";
|
|
9
|
-
export const RecentAgents = ({ onSelectAgent }) => {
|
|
10
|
-
const editContext = useEditContext();
|
|
11
|
-
const [agents, setAgents] = useState([]);
|
|
12
|
-
const [profile, setProfile] = useState(null);
|
|
13
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
14
|
-
const [showExpanded, setShowExpanded] = useState(false);
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
const loadData = async () => {
|
|
17
|
-
try {
|
|
18
|
-
setIsLoading(true);
|
|
19
|
-
// Load Parhelia profile
|
|
20
|
-
const profileList = await loadAiProfiles();
|
|
21
|
-
let assistantProfile;
|
|
22
|
-
assistantProfile = profileList.find((p) => p.id === "7d45ab97-f253-4915-8b32-f9e8c762c5e9");
|
|
23
|
-
if (!assistantProfile) {
|
|
24
|
-
assistantProfile = profileList.find((p) => p.name.toLowerCase() === "parhelia");
|
|
25
|
-
}
|
|
26
|
-
if (!assistantProfile) {
|
|
27
|
-
assistantProfile = profileList.find((p) => p.name.toLowerCase().includes("parhelia") ||
|
|
28
|
-
p.displayTitle?.toLowerCase().includes("parhelia"));
|
|
29
|
-
}
|
|
30
|
-
const selectedProfile = assistantProfile || profileList[0] || null;
|
|
31
|
-
setProfile(selectedProfile);
|
|
32
|
-
// Fetch all agents (both active and closed) for this profile
|
|
33
|
-
if (selectedProfile) {
|
|
34
|
-
const response = await getAgentsGrouped();
|
|
35
|
-
// Combine active agents with closed agents
|
|
36
|
-
const allAgents = [...response.activeAgents];
|
|
37
|
-
// Add closed agents from all profiles
|
|
38
|
-
response.closedAgentsByProfile.forEach(group => {
|
|
39
|
-
allAgents.push(...group.agents);
|
|
40
|
-
});
|
|
41
|
-
// Filter for Parhelia agents only
|
|
42
|
-
const parheliaAgents = allAgents.filter((a) => a.profileId === selectedProfile.id);
|
|
43
|
-
// Take the most recent 15 agents
|
|
44
|
-
setAgents(parheliaAgents.slice(0, 15));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch (err) {
|
|
48
|
-
console.error("Failed to load agents:", err);
|
|
49
|
-
}
|
|
50
|
-
finally {
|
|
51
|
-
setIsLoading(false);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
loadData();
|
|
55
|
-
}, []);
|
|
56
|
-
const handleOpenAgent = (agent) => {
|
|
57
|
-
// Use the callback to set the selected agent in the parent component
|
|
58
|
-
if (onSelectAgent) {
|
|
59
|
-
onSelectAgent(agent);
|
|
60
|
-
// Scroll to the top to show the chat interface
|
|
61
|
-
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const handleShowAll = () => {
|
|
65
|
-
editContext?.switchView("agents-overview");
|
|
66
|
-
editContext?.setShowAgentsPanel?.(true);
|
|
67
|
-
};
|
|
68
|
-
if (isLoading || agents.length === 0) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
// Show 3 agents by default, or 15 when expanded
|
|
72
|
-
const displayedAgents = showExpanded ? agents : agents.slice(0, 3);
|
|
73
|
-
const hasMoreAgents = agents.length > 3;
|
|
74
|
-
return (_jsxs("div", { className: "w-full", children: [_jsx("h2", { className: "mb-3 text-center text-sm font-medium text-gray-700", children: "Recent Conversations" }), _jsx("div", { className: "space-y-1.5", children: displayedAgents.map((agent) => (_jsxs("button", { onClick: () => handleOpenAgent(agent), className: "flex w-full items-center gap-2 px-2 py-1.5 text-left transition-colors hover:bg-white/50 rounded", children: [_jsx(MessageSquare, { className: "h-3.5 w-3.5 flex-shrink-0 text-gray-400", strokeWidth: 1.5 }), _jsx("div", { className: "flex-1 min-w-0", children: _jsx("span", { className: "text-xs text-gray-700 truncate block", children: agent.name }) })] }, agent.id))) }), hasMoreAgents && (_jsx("div", { className: "mt-3 flex gap-2", children: !showExpanded ? (_jsx(Button, { variant: "outline", size: "sm", onClick: () => setShowExpanded(true), className: "flex-1 text-xs", children: "Show More" })) : (_jsx(Button, { variant: "outline", size: "sm", onClick: handleShowAll, className: "flex-1 text-xs", children: "Show All" })) }))] }));
|
|
75
|
-
};
|
|
76
|
-
//# sourceMappingURL=RecentAgents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RecentAgents.js","sourceRoot":"","sources":["../../src/splash-screen/RecentAgents.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAa,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAS,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAMjD,MAAM,CAAC,MAAM,YAAY,GAAgC,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE;IAC7E,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAU,E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P,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { cn } from "../../lib/utils";
|
|
3
|
-
import { Button } from "./button";
|
|
4
|
-
import { X } from "lucide-react";
|
|
5
|
-
import { placeholderInputTypeRegistry } from "./PlaceholderInputTypes";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* PlaceholderInput component for AI Agent quick actions.
|
|
9
|
-
*
|
|
10
|
-
* Allows users to fill in placeholders in text templates with tab navigation.
|
|
11
|
-
*
|
|
12
|
-
* Example usage for AI Agents:
|
|
13
|
-
* ```json
|
|
14
|
-
* {
|
|
15
|
-
* "label": "Create Component",
|
|
16
|
-
* "prompt": "Create a {component_type} component named {component_name}",
|
|
17
|
-
* "behavior": "submit"
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* Supported placeholder formats:
|
|
22
|
-
* - Curly braces: {placeholder_name} or {0}, {1}, {2}
|
|
23
|
-
* - Angle brackets: <placeholder_name> or <0>, <1>, <2>
|
|
24
|
-
*
|
|
25
|
-
* Keyboard navigation:
|
|
26
|
-
* - Tab: Move to next placeholder (wraps to first)
|
|
27
|
-
* - Shift+Tab: Move to previous placeholder (wraps to last)
|
|
28
|
-
* - Enter: Submit with filled values
|
|
29
|
-
* - Escape: Cancel
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
export type Placeholder = {
|
|
33
|
-
name: string; // Display label
|
|
34
|
-
type: string; // "text", "item", "date", etc.
|
|
35
|
-
parameters: Record<string, string>; // Parsed key=value pairs
|
|
36
|
-
index: number;
|
|
37
|
-
startPos: number;
|
|
38
|
-
endPos: number;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
type PlaceholderInputProps = {
|
|
42
|
-
text: string;
|
|
43
|
-
onComplete: (filledText: string) => void;
|
|
44
|
-
onCancel?: () => void;
|
|
45
|
-
className?: string;
|
|
46
|
-
showButtons?: boolean;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
function parsePlaceholders(text: string): Placeholder[] {
|
|
50
|
-
const placeholders: Placeholder[] = [];
|
|
51
|
-
// Match both {placeholder} and <placeholder> formats
|
|
52
|
-
const regex = /\{([^}]+)\}|<([^>]+)>/g;
|
|
53
|
-
let match;
|
|
54
|
-
let index = 0;
|
|
55
|
-
|
|
56
|
-
while ((match = regex.exec(text)) !== null) {
|
|
57
|
-
// match[1] is for {placeholder}, match[2] is for <placeholder>
|
|
58
|
-
const placeholderContent = match[1] || match[2];
|
|
59
|
-
if (placeholderContent) {
|
|
60
|
-
// Parse the content: {label|type|param=value|param2=value2}
|
|
61
|
-
const parts = placeholderContent.split("|");
|
|
62
|
-
const label = parts[0]?.trim() || "";
|
|
63
|
-
const type = parts[1]?.trim() || "text"; // Default to "text" type
|
|
64
|
-
|
|
65
|
-
// Parse parameters from remaining parts (format: key=value)
|
|
66
|
-
const parameters: Record<string, string> = {};
|
|
67
|
-
for (let i = 2; i < parts.length; i++) {
|
|
68
|
-
const part = parts[i]?.trim() || "";
|
|
69
|
-
if (!part) continue;
|
|
70
|
-
const eqIndex = part.indexOf("=");
|
|
71
|
-
if (eqIndex !== -1) {
|
|
72
|
-
const key = part.substring(0, eqIndex).trim();
|
|
73
|
-
const value = part.substring(eqIndex + 1).trim();
|
|
74
|
-
if (key) {
|
|
75
|
-
parameters[key] = value;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
placeholders.push({
|
|
81
|
-
name: label,
|
|
82
|
-
type,
|
|
83
|
-
parameters,
|
|
84
|
-
index: index++,
|
|
85
|
-
startPos: match.index,
|
|
86
|
-
endPos: match.index + match[0].length,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return placeholders;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export function PlaceholderInput({
|
|
95
|
-
text,
|
|
96
|
-
onComplete,
|
|
97
|
-
onCancel,
|
|
98
|
-
className,
|
|
99
|
-
showButtons = true,
|
|
100
|
-
}: PlaceholderInputProps) {
|
|
101
|
-
const placeholders = React.useMemo(() => parsePlaceholders(text), [text]);
|
|
102
|
-
const [values, setValues] = React.useState<{ [key: number]: string }>({});
|
|
103
|
-
|
|
104
|
-
// Create refs for each placeholder using useRef to avoid the null issue
|
|
105
|
-
const inputRefs = React.useRef<{ [key: number]: HTMLInputElement | HTMLTextAreaElement | null }>({});
|
|
106
|
-
|
|
107
|
-
// Auto-focus first placeholder on mount
|
|
108
|
-
React.useEffect(() => {
|
|
109
|
-
if (placeholders.length > 0) {
|
|
110
|
-
const firstInput = inputRefs.current[0];
|
|
111
|
-
if (firstInput) {
|
|
112
|
-
setTimeout(() => firstInput.focus(), 0);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}, [placeholders.length]);
|
|
116
|
-
|
|
117
|
-
const handleValueChange = (index: number, value: string) => {
|
|
118
|
-
setValues((prev) => ({ ...prev, [index]: value }));
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const handleKeyDown = (
|
|
122
|
-
e: React.KeyboardEvent,
|
|
123
|
-
index: number,
|
|
124
|
-
) => {
|
|
125
|
-
if (e.key === "Tab") {
|
|
126
|
-
e.preventDefault();
|
|
127
|
-
if (e.shiftKey) {
|
|
128
|
-
// Shift+Tab: go to previous input (wrap to last if at first)
|
|
129
|
-
const prevIndex = index - 1;
|
|
130
|
-
if (prevIndex >= 0) {
|
|
131
|
-
inputRefs.current[prevIndex]?.focus();
|
|
132
|
-
} else {
|
|
133
|
-
// Wrap to last placeholder
|
|
134
|
-
inputRefs.current[placeholders.length - 1]?.focus();
|
|
135
|
-
}
|
|
136
|
-
} else {
|
|
137
|
-
// Tab: go to next input (wrap to first if at last)
|
|
138
|
-
const nextIndex = index + 1;
|
|
139
|
-
if (nextIndex < placeholders.length) {
|
|
140
|
-
inputRefs.current[nextIndex]?.focus();
|
|
141
|
-
} else {
|
|
142
|
-
// Wrap to first placeholder
|
|
143
|
-
inputRefs.current[0]?.focus();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
} else if (e.key === "Enter") {
|
|
147
|
-
e.preventDefault();
|
|
148
|
-
handleSubmit();
|
|
149
|
-
} else if (e.key === "Escape") {
|
|
150
|
-
e.preventDefault();
|
|
151
|
-
onCancel?.();
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const handleSubmit = () => {
|
|
156
|
-
// Build the filled text by replacing placeholders with values
|
|
157
|
-
let filledText = text;
|
|
158
|
-
// Replace in reverse order to maintain correct positions
|
|
159
|
-
for (let i = placeholders.length - 1; i >= 0; i--) {
|
|
160
|
-
const placeholder = placeholders[i];
|
|
161
|
-
if (!placeholder) continue;
|
|
162
|
-
const value = values[i] || "";
|
|
163
|
-
|
|
164
|
-
// Format the value based on placeholder type and parameters
|
|
165
|
-
let formattedValue = value;
|
|
166
|
-
|
|
167
|
-
if (placeholder.type === "item" && value.includes("|")) {
|
|
168
|
-
// Parse item value format: "id|path"
|
|
169
|
-
const parts = value.split("|");
|
|
170
|
-
const id = parts[0] || "";
|
|
171
|
-
const path = parts[1] || "";
|
|
172
|
-
const name = path.split("/").pop() || "";
|
|
173
|
-
// For item placeholders, output both ID and name
|
|
174
|
-
formattedValue = `{${id}} (${name})`;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
filledText =
|
|
178
|
-
filledText.substring(0, placeholder.startPos) +
|
|
179
|
-
formattedValue +
|
|
180
|
-
filledText.substring(placeholder.endPos);
|
|
181
|
-
}
|
|
182
|
-
onComplete(filledText);
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
if (placeholders.length === 0) {
|
|
186
|
-
// No placeholders, just display text
|
|
187
|
-
return <div className={cn("text-xs", className)}>{text}</div>;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Build segments: text and placeholder inputs
|
|
191
|
-
const segments: React.ReactNode[] = [];
|
|
192
|
-
let lastPos = 0;
|
|
193
|
-
|
|
194
|
-
placeholders.forEach((placeholder, idx) => {
|
|
195
|
-
// Add text before this placeholder
|
|
196
|
-
if (placeholder.startPos > lastPos) {
|
|
197
|
-
segments.push(
|
|
198
|
-
<span key={`text-${idx}`} className="whitespace-pre-wrap">
|
|
199
|
-
{text.substring(lastPos, placeholder.startPos)}
|
|
200
|
-
</span>,
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Add input for this placeholder
|
|
205
|
-
// Look up the component for this placeholder type
|
|
206
|
-
const typeConfig = placeholderInputTypeRegistry.get(placeholder.type);
|
|
207
|
-
const InputComponent = typeConfig?.component;
|
|
208
|
-
|
|
209
|
-
if (InputComponent) {
|
|
210
|
-
segments.push(
|
|
211
|
-
<InputComponent
|
|
212
|
-
key={`input-${idx}`}
|
|
213
|
-
placeholder={placeholder}
|
|
214
|
-
value={values[idx] || ""}
|
|
215
|
-
onChange={(value) => handleValueChange(idx, value)}
|
|
216
|
-
onKeyDown={(e) => handleKeyDown(e, idx)}
|
|
217
|
-
inputRef={(el) => {
|
|
218
|
-
inputRefs.current[idx] = el;
|
|
219
|
-
}}
|
|
220
|
-
autoFocus={idx === 0}
|
|
221
|
-
/>,
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
lastPos = placeholder.endPos;
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
// Add remaining text after last placeholder
|
|
229
|
-
if (lastPos < text.length) {
|
|
230
|
-
segments.push(
|
|
231
|
-
<span key="text-end" className="whitespace-pre-wrap">
|
|
232
|
-
{text.substring(lastPos)}
|
|
233
|
-
</span>,
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
const allFilled = placeholders.every((_, idx) => {
|
|
238
|
-
const value = values[idx];
|
|
239
|
-
return value !== undefined && value.trim() !== "";
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
return (
|
|
243
|
-
<div className={cn("space-y-2", className)}>
|
|
244
|
-
<div className={cn(
|
|
245
|
-
"relative flex flex-wrap items-center gap-1 rounded-lg border border-blue-200 bg-blue-50/50 p-3 text-xs h-[80px] overflow-y-auto",
|
|
246
|
-
onCancel && "pr-8"
|
|
247
|
-
)}>
|
|
248
|
-
{segments}
|
|
249
|
-
{onCancel && (
|
|
250
|
-
<button
|
|
251
|
-
onClick={onCancel}
|
|
252
|
-
className="absolute right-2 top-2 rounded p-0.5 text-gray-400 hover:bg-blue-100 hover:text-gray-600 transition-colors"
|
|
253
|
-
title="Cancel (Esc)"
|
|
254
|
-
aria-label="Cancel"
|
|
255
|
-
>
|
|
256
|
-
<X size={14} strokeWidth={2} />
|
|
257
|
-
</button>
|
|
258
|
-
)}
|
|
259
|
-
</div>
|
|
260
|
-
{showButtons && (
|
|
261
|
-
<div className="flex items-center gap-2">
|
|
262
|
-
<Button
|
|
263
|
-
size="sm"
|
|
264
|
-
onClick={handleSubmit}
|
|
265
|
-
disabled={!allFilled}
|
|
266
|
-
className="h-7"
|
|
267
|
-
>
|
|
268
|
-
Submit
|
|
269
|
-
</Button>
|
|
270
|
-
{onCancel && (
|
|
271
|
-
<Button
|
|
272
|
-
size="sm"
|
|
273
|
-
variant="ghost"
|
|
274
|
-
onClick={onCancel}
|
|
275
|
-
className="h-7"
|
|
276
|
-
>
|
|
277
|
-
Cancel
|
|
278
|
-
</Button>
|
|
279
|
-
)}
|
|
280
|
-
{!allFilled && (
|
|
281
|
-
<span className="text-xs text-gray-500">
|
|
282
|
-
Fill all fields (use Tab to navigate)
|
|
283
|
-
</span>
|
|
284
|
-
)}
|
|
285
|
-
</div>
|
|
286
|
-
)}
|
|
287
|
-
</div>
|
|
288
|
-
);
|
|
289
|
-
}
|
|
290
|
-
|