@usecrow/ui 0.1.65 → 0.1.67
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.cjs +139 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -3
- package/dist/index.d.ts +40 -3
- package/dist/index.js +139 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -207,6 +207,14 @@ interface WidgetConfigResponse {
|
|
|
207
207
|
toolConsentSettings?: Record<string, {
|
|
208
208
|
requires_consent: boolean;
|
|
209
209
|
}>;
|
|
210
|
+
/** Whether end-user model selection is enabled */
|
|
211
|
+
modelSelectionEnabled?: boolean;
|
|
212
|
+
/** Available models for end-user selection (model IDs + display info) */
|
|
213
|
+
availableModels?: Array<{
|
|
214
|
+
id: string;
|
|
215
|
+
name: string;
|
|
216
|
+
provider: "OpenAI" | "Anthropic";
|
|
217
|
+
}>;
|
|
210
218
|
}
|
|
211
219
|
|
|
212
220
|
/**
|
|
@@ -320,6 +328,7 @@ declare global {
|
|
|
320
328
|
__crow_identity_token_fetcher?: () => Promise<string>;
|
|
321
329
|
__crow_on_tool_result?: (toolName: string, result: Record<string, unknown>) => void;
|
|
322
330
|
__crow_tool_renderers?: ToolRenderers;
|
|
331
|
+
__crow_context_label?: string;
|
|
323
332
|
}
|
|
324
333
|
}
|
|
325
334
|
|
|
@@ -396,8 +405,13 @@ interface CrowWidgetProps {
|
|
|
396
405
|
* Appended after default styles, allowing overrides.
|
|
397
406
|
*/
|
|
398
407
|
customCss?: string;
|
|
408
|
+
/**
|
|
409
|
+
* Label shown at the top of the widget indicating what page/context the AI
|
|
410
|
+
* is aware of. Prop takes priority over window.crow('setContextLabel', ...).
|
|
411
|
+
*/
|
|
412
|
+
contextLabel?: string;
|
|
399
413
|
}
|
|
400
|
-
declare function CrowWidget({ productId, apiUrl, subdomain, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, toolRenderers, language, customCss, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
|
|
414
|
+
declare function CrowWidget({ productId, apiUrl, subdomain, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, toolRenderers, language, customCss, contextLabel: contextLabelProp, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
|
|
401
415
|
|
|
402
416
|
interface CrowCopilotProps {
|
|
403
417
|
/** Product ID for this copilot */
|
|
@@ -479,8 +493,13 @@ interface CrowCopilotProps {
|
|
|
479
493
|
* responds in that language and the welcome message is translated.
|
|
480
494
|
*/
|
|
481
495
|
language?: string;
|
|
496
|
+
/**
|
|
497
|
+
* Label shown at the top of the copilot indicating what page/context the AI
|
|
498
|
+
* is aware of. Prop takes priority over window.crow('setContextLabel', ...).
|
|
499
|
+
*/
|
|
500
|
+
contextLabel?: string;
|
|
482
501
|
}
|
|
483
|
-
declare function CrowCopilot({ productId, apiUrl, subdomain, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, language, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
|
|
502
|
+
declare function CrowCopilot({ productId, apiUrl, subdomain, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, language, contextLabel: contextLabelProp, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
|
|
484
503
|
|
|
485
504
|
interface CrowProviderProps extends CrowClientConfig {
|
|
486
505
|
children: React.ReactNode;
|
|
@@ -852,6 +871,14 @@ interface UseWidgetStylesResult {
|
|
|
852
871
|
toolConsentSettings: Record<string, {
|
|
853
872
|
requires_consent: boolean;
|
|
854
873
|
}>;
|
|
874
|
+
/** Whether end-user model selection is enabled */
|
|
875
|
+
modelSelectionEnabled: boolean;
|
|
876
|
+
/** Available models for the dropdown */
|
|
877
|
+
availableModels: Array<{
|
|
878
|
+
id: string;
|
|
879
|
+
name: string;
|
|
880
|
+
provider: "OpenAI" | "Anthropic";
|
|
881
|
+
}>;
|
|
855
882
|
/** Refetch styles from API */
|
|
856
883
|
refetch: () => Promise<void>;
|
|
857
884
|
}
|
|
@@ -899,6 +926,14 @@ interface UseCopilotStylesResult {
|
|
|
899
926
|
toolConsentSettings: Record<string, {
|
|
900
927
|
requires_consent: boolean;
|
|
901
928
|
}>;
|
|
929
|
+
/** Whether end-user model selection is enabled */
|
|
930
|
+
modelSelectionEnabled: boolean;
|
|
931
|
+
/** Available models for the dropdown */
|
|
932
|
+
availableModels: Array<{
|
|
933
|
+
id: string;
|
|
934
|
+
name: string;
|
|
935
|
+
provider: "OpenAI" | "Anthropic";
|
|
936
|
+
}>;
|
|
902
937
|
/** Refetch styles from API */
|
|
903
938
|
refetch: () => Promise<void>;
|
|
904
939
|
}
|
|
@@ -1183,8 +1218,10 @@ interface WidgetHeaderProps {
|
|
|
1183
1218
|
hasCustomTransform?: boolean;
|
|
1184
1219
|
/** Reset position & size to defaults */
|
|
1185
1220
|
onResetTransform?: () => void;
|
|
1221
|
+
/** Context label displayed below the header row */
|
|
1222
|
+
contextLabel?: string;
|
|
1186
1223
|
}
|
|
1187
|
-
declare function WidgetHeader({ isVerifiedUser, showConversationList, onNewChat, onToggleHistory, showMinimize, onToggleMinimize, onDragPointerDown, isDragging, hasCustomTransform, onResetTransform, }: WidgetHeaderProps): react_jsx_runtime.JSX.Element;
|
|
1224
|
+
declare function WidgetHeader({ isVerifiedUser, showConversationList, onNewChat, onToggleHistory, showMinimize, onToggleMinimize, onDragPointerDown, isDragging, hasCustomTransform, onResetTransform, contextLabel, }: WidgetHeaderProps): react_jsx_runtime.JSX.Element;
|
|
1188
1225
|
|
|
1189
1226
|
/**
|
|
1190
1227
|
* CopilotToggleButton - Edge toggle button for floating copilot
|
package/dist/index.d.ts
CHANGED
|
@@ -207,6 +207,14 @@ interface WidgetConfigResponse {
|
|
|
207
207
|
toolConsentSettings?: Record<string, {
|
|
208
208
|
requires_consent: boolean;
|
|
209
209
|
}>;
|
|
210
|
+
/** Whether end-user model selection is enabled */
|
|
211
|
+
modelSelectionEnabled?: boolean;
|
|
212
|
+
/** Available models for end-user selection (model IDs + display info) */
|
|
213
|
+
availableModels?: Array<{
|
|
214
|
+
id: string;
|
|
215
|
+
name: string;
|
|
216
|
+
provider: "OpenAI" | "Anthropic";
|
|
217
|
+
}>;
|
|
210
218
|
}
|
|
211
219
|
|
|
212
220
|
/**
|
|
@@ -320,6 +328,7 @@ declare global {
|
|
|
320
328
|
__crow_identity_token_fetcher?: () => Promise<string>;
|
|
321
329
|
__crow_on_tool_result?: (toolName: string, result: Record<string, unknown>) => void;
|
|
322
330
|
__crow_tool_renderers?: ToolRenderers;
|
|
331
|
+
__crow_context_label?: string;
|
|
323
332
|
}
|
|
324
333
|
}
|
|
325
334
|
|
|
@@ -396,8 +405,13 @@ interface CrowWidgetProps {
|
|
|
396
405
|
* Appended after default styles, allowing overrides.
|
|
397
406
|
*/
|
|
398
407
|
customCss?: string;
|
|
408
|
+
/**
|
|
409
|
+
* Label shown at the top of the widget indicating what page/context the AI
|
|
410
|
+
* is aware of. Prop takes priority over window.crow('setContextLabel', ...).
|
|
411
|
+
*/
|
|
412
|
+
contextLabel?: string;
|
|
399
413
|
}
|
|
400
|
-
declare function CrowWidget({ productId, apiUrl, subdomain, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, toolRenderers, language, customCss, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
|
|
414
|
+
declare function CrowWidget({ productId, apiUrl, subdomain, variant, styles: propStyles, previewMode, showThinking: showThinkingProp, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, onReady, onIdentify, tools, navigate, onToolResult, getIdentityToken, context, toolRenderers, language, customCss, contextLabel: contextLabelProp, }: CrowWidgetProps): react_jsx_runtime.JSX.Element;
|
|
401
415
|
|
|
402
416
|
interface CrowCopilotProps {
|
|
403
417
|
/** Product ID for this copilot */
|
|
@@ -479,8 +493,13 @@ interface CrowCopilotProps {
|
|
|
479
493
|
* responds in that language and the welcome message is translated.
|
|
480
494
|
*/
|
|
481
495
|
language?: string;
|
|
496
|
+
/**
|
|
497
|
+
* Label shown at the top of the copilot indicating what page/context the AI
|
|
498
|
+
* is aware of. Prop takes priority over window.crow('setContextLabel', ...).
|
|
499
|
+
*/
|
|
500
|
+
contextLabel?: string;
|
|
482
501
|
}
|
|
483
|
-
declare function CrowCopilot({ productId, apiUrl, subdomain, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, language, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
|
|
502
|
+
declare function CrowCopilot({ productId, apiUrl, subdomain, variant, title, agentName: agentNameProp, welcomeMessage: welcomeMessageProp, position, width, defaultOpen, showClose, onClose, styles: propStyles, previewMode, className, onReady, navigate, onToolResult, toolRenderers, getIdentityToken, context, language, contextLabel: contextLabelProp, }: CrowCopilotProps): react_jsx_runtime.JSX.Element;
|
|
484
503
|
|
|
485
504
|
interface CrowProviderProps extends CrowClientConfig {
|
|
486
505
|
children: React.ReactNode;
|
|
@@ -852,6 +871,14 @@ interface UseWidgetStylesResult {
|
|
|
852
871
|
toolConsentSettings: Record<string, {
|
|
853
872
|
requires_consent: boolean;
|
|
854
873
|
}>;
|
|
874
|
+
/** Whether end-user model selection is enabled */
|
|
875
|
+
modelSelectionEnabled: boolean;
|
|
876
|
+
/** Available models for the dropdown */
|
|
877
|
+
availableModels: Array<{
|
|
878
|
+
id: string;
|
|
879
|
+
name: string;
|
|
880
|
+
provider: "OpenAI" | "Anthropic";
|
|
881
|
+
}>;
|
|
855
882
|
/** Refetch styles from API */
|
|
856
883
|
refetch: () => Promise<void>;
|
|
857
884
|
}
|
|
@@ -899,6 +926,14 @@ interface UseCopilotStylesResult {
|
|
|
899
926
|
toolConsentSettings: Record<string, {
|
|
900
927
|
requires_consent: boolean;
|
|
901
928
|
}>;
|
|
929
|
+
/** Whether end-user model selection is enabled */
|
|
930
|
+
modelSelectionEnabled: boolean;
|
|
931
|
+
/** Available models for the dropdown */
|
|
932
|
+
availableModels: Array<{
|
|
933
|
+
id: string;
|
|
934
|
+
name: string;
|
|
935
|
+
provider: "OpenAI" | "Anthropic";
|
|
936
|
+
}>;
|
|
902
937
|
/** Refetch styles from API */
|
|
903
938
|
refetch: () => Promise<void>;
|
|
904
939
|
}
|
|
@@ -1183,8 +1218,10 @@ interface WidgetHeaderProps {
|
|
|
1183
1218
|
hasCustomTransform?: boolean;
|
|
1184
1219
|
/** Reset position & size to defaults */
|
|
1185
1220
|
onResetTransform?: () => void;
|
|
1221
|
+
/** Context label displayed below the header row */
|
|
1222
|
+
contextLabel?: string;
|
|
1186
1223
|
}
|
|
1187
|
-
declare function WidgetHeader({ isVerifiedUser, showConversationList, onNewChat, onToggleHistory, showMinimize, onToggleMinimize, onDragPointerDown, isDragging, hasCustomTransform, onResetTransform, }: WidgetHeaderProps): react_jsx_runtime.JSX.Element;
|
|
1224
|
+
declare function WidgetHeader({ isVerifiedUser, showConversationList, onNewChat, onToggleHistory, showMinimize, onToggleMinimize, onDragPointerDown, isDragging, hasCustomTransform, onResetTransform, contextLabel, }: WidgetHeaderProps): react_jsx_runtime.JSX.Element;
|
|
1188
1225
|
|
|
1189
1226
|
/**
|
|
1190
1227
|
* CopilotToggleButton - Edge toggle button for floating copilot
|
package/dist/index.js
CHANGED
|
@@ -1237,6 +1237,16 @@ function useCrowAPI({ onIdentified, onReset } = {}) {
|
|
|
1237
1237
|
}
|
|
1238
1238
|
return crowAsk(opts);
|
|
1239
1239
|
}
|
|
1240
|
+
case "setContextLabel":
|
|
1241
|
+
if (typeof options !== "string") {
|
|
1242
|
+
console.error("[Crow] setContextLabel() requires a string");
|
|
1243
|
+
return;
|
|
1244
|
+
}
|
|
1245
|
+
window.__crow_context_label = options || void 0;
|
|
1246
|
+
window.dispatchEvent(
|
|
1247
|
+
new CustomEvent("crow:setContextLabel", { detail: options })
|
|
1248
|
+
);
|
|
1249
|
+
break;
|
|
1240
1250
|
case "setSuggestedActions":
|
|
1241
1251
|
if (!Array.isArray(options)) {
|
|
1242
1252
|
console.error("[Crow] setSuggestedActions() requires an array of { label, message }");
|
|
@@ -1602,6 +1612,12 @@ function useWidgetStyles({
|
|
|
1602
1612
|
const [selectedModel, setSelectedModel] = useState(
|
|
1603
1613
|
styleCache.get(key)?.model ?? void 0
|
|
1604
1614
|
);
|
|
1615
|
+
const [modelSelectionEnabled, setModelSelectionEnabled] = useState(
|
|
1616
|
+
styleCache.get(key)?.modelSelectionEnabled || false
|
|
1617
|
+
);
|
|
1618
|
+
const [availableModels, setAvailableModels] = useState(
|
|
1619
|
+
styleCache.get(key)?.availableModels || []
|
|
1620
|
+
);
|
|
1605
1621
|
const hasFetchedRef = useRef(false);
|
|
1606
1622
|
const fetchStyles = async () => {
|
|
1607
1623
|
if (skip) return;
|
|
@@ -1621,6 +1637,8 @@ function useWidgetStyles({
|
|
|
1621
1637
|
setSelectedModel(config.model ?? void 0);
|
|
1622
1638
|
setInitialSuggestions(config.initialSuggestions || []);
|
|
1623
1639
|
setToolConsentSettings(config.toolConsentSettings || {});
|
|
1640
|
+
setModelSelectionEnabled(config.modelSelectionEnabled || false);
|
|
1641
|
+
setAvailableModels(config.availableModels || []);
|
|
1624
1642
|
} catch (err) {
|
|
1625
1643
|
console.error("[CrowWidget] Failed to fetch styles:", err);
|
|
1626
1644
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
@@ -1639,6 +1657,8 @@ function useWidgetStyles({
|
|
|
1639
1657
|
setPersistAnonymousConversations(cached.persistAnonymousConversations ?? true);
|
|
1640
1658
|
setWelcomeMessage(cached.welcomeMessage ?? void 0);
|
|
1641
1659
|
setSelectedModel(cached.model ?? void 0);
|
|
1660
|
+
setModelSelectionEnabled(cached.modelSelectionEnabled || false);
|
|
1661
|
+
setAvailableModels(cached.availableModels || []);
|
|
1642
1662
|
setIsLoading(false);
|
|
1643
1663
|
return;
|
|
1644
1664
|
}
|
|
@@ -1660,6 +1680,8 @@ function useWidgetStyles({
|
|
|
1660
1680
|
selectedModel,
|
|
1661
1681
|
initialSuggestions,
|
|
1662
1682
|
toolConsentSettings,
|
|
1683
|
+
modelSelectionEnabled,
|
|
1684
|
+
availableModels,
|
|
1663
1685
|
refetch: fetchStyles
|
|
1664
1686
|
};
|
|
1665
1687
|
}
|
|
@@ -1699,6 +1721,12 @@ function useCopilotStyles({
|
|
|
1699
1721
|
const [toolConsentSettings, setToolConsentSettings] = useState(
|
|
1700
1722
|
styleCache.get(key)?.toolConsentSettings || {}
|
|
1701
1723
|
);
|
|
1724
|
+
const [modelSelectionEnabled, setModelSelectionEnabled] = useState(
|
|
1725
|
+
styleCache.get(key)?.modelSelectionEnabled || false
|
|
1726
|
+
);
|
|
1727
|
+
const [availableModels, setAvailableModels] = useState(
|
|
1728
|
+
styleCache.get(key)?.availableModels || []
|
|
1729
|
+
);
|
|
1702
1730
|
const hasFetchedRef = useRef(false);
|
|
1703
1731
|
const fetchStyles = async () => {
|
|
1704
1732
|
if (skip) return;
|
|
@@ -1716,6 +1744,8 @@ function useCopilotStyles({
|
|
|
1716
1744
|
setWelcomeMessage(config.welcomeMessage ?? void 0);
|
|
1717
1745
|
setSelectedModel(config.model ?? void 0);
|
|
1718
1746
|
setToolConsentSettings(config.toolConsentSettings || {});
|
|
1747
|
+
setModelSelectionEnabled(config.modelSelectionEnabled || false);
|
|
1748
|
+
setAvailableModels(config.availableModels || []);
|
|
1719
1749
|
} catch (err) {
|
|
1720
1750
|
console.error("[CrowCopilot] Failed to fetch styles:", err);
|
|
1721
1751
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
@@ -1735,6 +1765,8 @@ function useCopilotStyles({
|
|
|
1735
1765
|
setPersistAnonymousConversations(cached.persistAnonymousConversations ?? true);
|
|
1736
1766
|
setWelcomeMessage(cached.welcomeMessage ?? void 0);
|
|
1737
1767
|
setSelectedModel(cached.model ?? void 0);
|
|
1768
|
+
setModelSelectionEnabled(cached.modelSelectionEnabled || false);
|
|
1769
|
+
setAvailableModels(cached.availableModels || []);
|
|
1738
1770
|
setIsLoading(false);
|
|
1739
1771
|
return;
|
|
1740
1772
|
}
|
|
@@ -1754,6 +1786,8 @@ function useCopilotStyles({
|
|
|
1754
1786
|
welcomeMessage,
|
|
1755
1787
|
selectedModel,
|
|
1756
1788
|
toolConsentSettings,
|
|
1789
|
+
modelSelectionEnabled,
|
|
1790
|
+
availableModels,
|
|
1757
1791
|
refetch: fetchStyles
|
|
1758
1792
|
};
|
|
1759
1793
|
}
|
|
@@ -2438,7 +2472,8 @@ function WidgetHeader({
|
|
|
2438
2472
|
onDragPointerDown,
|
|
2439
2473
|
isDragging,
|
|
2440
2474
|
hasCustomTransform,
|
|
2441
|
-
onResetTransform
|
|
2475
|
+
onResetTransform,
|
|
2476
|
+
contextLabel
|
|
2442
2477
|
}) {
|
|
2443
2478
|
const { agentName, styles } = useWidgetStyleContext();
|
|
2444
2479
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2526,7 +2561,36 @@ function WidgetHeader({
|
|
|
2526
2561
|
children: /* @__PURE__ */ jsx(X, { size: 18, className: "crow-text-gray-700" })
|
|
2527
2562
|
}
|
|
2528
2563
|
)
|
|
2529
|
-
] })
|
|
2564
|
+
] }),
|
|
2565
|
+
contextLabel && /* @__PURE__ */ jsxs(
|
|
2566
|
+
"div",
|
|
2567
|
+
{
|
|
2568
|
+
className: "crow-flex crow-items-center crow-gap-1.5 crow-mt-1 crow-text-xs",
|
|
2569
|
+
style: { color: "#6b7280" },
|
|
2570
|
+
children: [
|
|
2571
|
+
/* @__PURE__ */ jsxs(
|
|
2572
|
+
"svg",
|
|
2573
|
+
{
|
|
2574
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2575
|
+
width: "12",
|
|
2576
|
+
height: "12",
|
|
2577
|
+
viewBox: "0 0 24 24",
|
|
2578
|
+
fill: "none",
|
|
2579
|
+
stroke: "currentColor",
|
|
2580
|
+
strokeWidth: "2",
|
|
2581
|
+
strokeLinecap: "round",
|
|
2582
|
+
strokeLinejoin: "round",
|
|
2583
|
+
className: "crow-shrink-0",
|
|
2584
|
+
children: [
|
|
2585
|
+
/* @__PURE__ */ jsx("path", { d: "M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z" }),
|
|
2586
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "10", r: "3" })
|
|
2587
|
+
]
|
|
2588
|
+
}
|
|
2589
|
+
),
|
|
2590
|
+
/* @__PURE__ */ jsx("span", { className: "crow-truncate", children: contextLabel })
|
|
2591
|
+
]
|
|
2592
|
+
}
|
|
2593
|
+
)
|
|
2530
2594
|
]
|
|
2531
2595
|
}
|
|
2532
2596
|
);
|
|
@@ -3165,7 +3229,9 @@ var ModelSelector = ({
|
|
|
3165
3229
|
const dropdownRef = useRef(null);
|
|
3166
3230
|
useEffect(() => {
|
|
3167
3231
|
const handleClickOutside = (event) => {
|
|
3168
|
-
if (
|
|
3232
|
+
if (!dropdownRef.current) return;
|
|
3233
|
+
const path = event.composedPath();
|
|
3234
|
+
if (!path.includes(dropdownRef.current)) {
|
|
3169
3235
|
setIsOpen(false);
|
|
3170
3236
|
}
|
|
3171
3237
|
};
|
|
@@ -4132,7 +4198,8 @@ function CrowWidget({
|
|
|
4132
4198
|
context,
|
|
4133
4199
|
toolRenderers,
|
|
4134
4200
|
language,
|
|
4135
|
-
customCss
|
|
4201
|
+
customCss,
|
|
4202
|
+
contextLabel: contextLabelProp
|
|
4136
4203
|
}) {
|
|
4137
4204
|
const effectiveGetIdentityToken = getIdentityToken || window.__crow_identity_token_fetcher;
|
|
4138
4205
|
const effectiveOnToolResult = onToolResult || window.__crow_on_tool_result;
|
|
@@ -4149,7 +4216,9 @@ function CrowWidget({
|
|
|
4149
4216
|
welcomeMessage: welcomeMessageFromAPI,
|
|
4150
4217
|
selectedModel: selectedModelFromAPI,
|
|
4151
4218
|
initialSuggestions,
|
|
4152
|
-
toolConsentSettings
|
|
4219
|
+
toolConsentSettings,
|
|
4220
|
+
modelSelectionEnabled,
|
|
4221
|
+
availableModels: availableModelsFromAPI
|
|
4153
4222
|
} = useWidgetStyles({
|
|
4154
4223
|
productId,
|
|
4155
4224
|
apiUrl,
|
|
@@ -4173,6 +4242,15 @@ function CrowWidget({
|
|
|
4173
4242
|
window.addEventListener("crow:setGreeting", handler);
|
|
4174
4243
|
return () => window.removeEventListener("crow:setGreeting", handler);
|
|
4175
4244
|
}, []);
|
|
4245
|
+
const [contextLabelFromAPI, setContextLabelFromAPI] = useState(
|
|
4246
|
+
() => window.__crow_context_label
|
|
4247
|
+
);
|
|
4248
|
+
useEffect(() => {
|
|
4249
|
+
const handler = (e) => setContextLabelFromAPI(e.detail || void 0);
|
|
4250
|
+
window.addEventListener("crow:setContextLabel", handler);
|
|
4251
|
+
return () => window.removeEventListener("crow:setContextLabel", handler);
|
|
4252
|
+
}, []);
|
|
4253
|
+
const contextLabel = contextLabelProp ?? contextLabelFromAPI;
|
|
4176
4254
|
const agentName = agentNameProp ?? agentNameFromAPI;
|
|
4177
4255
|
const welcomeMessage = greetingOverride ?? welcomeMessageProp ?? welcomeMessageFromAPI;
|
|
4178
4256
|
const selectedModel = selectedModelFromAPI;
|
|
@@ -4663,7 +4741,8 @@ function CrowWidget({
|
|
|
4663
4741
|
onDragPointerDown: variant === "floating" ? transform.onDragPointerDown : void 0,
|
|
4664
4742
|
isDragging: transform.isDragging,
|
|
4665
4743
|
hasCustomTransform: transform.hasCustomTransform,
|
|
4666
|
-
onResetTransform: transform.resetTransform
|
|
4744
|
+
onResetTransform: transform.resetTransform,
|
|
4745
|
+
contextLabel
|
|
4667
4746
|
}
|
|
4668
4747
|
),
|
|
4669
4748
|
/* @__PURE__ */ jsx(AnimatePresence, { children: showConversationList && isVerifiedUser && /* @__PURE__ */ jsx(
|
|
@@ -4736,7 +4815,10 @@ function CrowWidget({
|
|
|
4736
4815
|
showStopButton: isBrowserUseActive || !!askUserResolver || !!pendingConfirmation,
|
|
4737
4816
|
highlighted: !!askUserResolver,
|
|
4738
4817
|
className: "crow-backdrop-blur-md",
|
|
4739
|
-
backendUrl: apiUrl
|
|
4818
|
+
backendUrl: apiUrl,
|
|
4819
|
+
selectedModel: chat.selectedModel || selectedModelFromAPI,
|
|
4820
|
+
onModelChange: chat.setSelectedModel,
|
|
4821
|
+
availableModels: modelSelectionEnabled ? availableModelsFromAPI : []
|
|
4740
4822
|
}
|
|
4741
4823
|
)
|
|
4742
4824
|
] })
|
|
@@ -5055,7 +5137,8 @@ function CrowCopilot({
|
|
|
5055
5137
|
toolRenderers,
|
|
5056
5138
|
getIdentityToken,
|
|
5057
5139
|
context,
|
|
5058
|
-
language
|
|
5140
|
+
language,
|
|
5141
|
+
contextLabel: contextLabelProp
|
|
5059
5142
|
}) {
|
|
5060
5143
|
const effectiveGetIdentityToken = getIdentityToken || window.__crow_identity_token_fetcher;
|
|
5061
5144
|
const effectiveOnToolResult = onToolResult || window.__crow_on_tool_result;
|
|
@@ -5070,7 +5153,9 @@ function CrowCopilot({
|
|
|
5070
5153
|
persistAnonymousConversations,
|
|
5071
5154
|
welcomeMessage: welcomeMessageFromAPI,
|
|
5072
5155
|
selectedModel,
|
|
5073
|
-
toolConsentSettings
|
|
5156
|
+
toolConsentSettings,
|
|
5157
|
+
modelSelectionEnabled,
|
|
5158
|
+
availableModels: availableModelsFromAPI
|
|
5074
5159
|
} = useCopilotStyles({
|
|
5075
5160
|
productId,
|
|
5076
5161
|
apiUrl,
|
|
@@ -5096,6 +5181,15 @@ function CrowCopilot({
|
|
|
5096
5181
|
return () => window.removeEventListener("crow:setGreeting", handler);
|
|
5097
5182
|
}, []);
|
|
5098
5183
|
const welcomeMessage = greetingOverride ?? welcomeMessageProp ?? welcomeMessageFromAPI;
|
|
5184
|
+
const [contextLabelFromAPI, setContextLabelFromAPI] = useState(
|
|
5185
|
+
() => window.__crow_context_label
|
|
5186
|
+
);
|
|
5187
|
+
useEffect(() => {
|
|
5188
|
+
const handler = (e) => setContextLabelFromAPI(e.detail || void 0);
|
|
5189
|
+
window.addEventListener("crow:setContextLabel", handler);
|
|
5190
|
+
return () => window.removeEventListener("crow:setContextLabel", handler);
|
|
5191
|
+
}, []);
|
|
5192
|
+
const contextLabel = contextLabelProp ?? contextLabelFromAPI;
|
|
5099
5193
|
const [autoTools, setAutoTools] = useState({});
|
|
5100
5194
|
const browserUseLoaded = autoTools.browser_use;
|
|
5101
5195
|
useEffect(() => {
|
|
@@ -5910,6 +6004,38 @@ function CrowCopilot({
|
|
|
5910
6004
|
]
|
|
5911
6005
|
}
|
|
5912
6006
|
),
|
|
6007
|
+
contextLabel && /* @__PURE__ */ jsxs(
|
|
6008
|
+
"div",
|
|
6009
|
+
{
|
|
6010
|
+
className: "crow-flex crow-items-center crow-gap-1.5 crow-px-3 crow-py-1.5 crow-border-b crow-text-xs",
|
|
6011
|
+
style: {
|
|
6012
|
+
color: "#6b7280",
|
|
6013
|
+
borderColor: styles.colors.border
|
|
6014
|
+
},
|
|
6015
|
+
children: [
|
|
6016
|
+
/* @__PURE__ */ jsxs(
|
|
6017
|
+
"svg",
|
|
6018
|
+
{
|
|
6019
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6020
|
+
width: "12",
|
|
6021
|
+
height: "12",
|
|
6022
|
+
viewBox: "0 0 24 24",
|
|
6023
|
+
fill: "none",
|
|
6024
|
+
stroke: "currentColor",
|
|
6025
|
+
strokeWidth: "2",
|
|
6026
|
+
strokeLinecap: "round",
|
|
6027
|
+
strokeLinejoin: "round",
|
|
6028
|
+
className: "crow-shrink-0",
|
|
6029
|
+
children: [
|
|
6030
|
+
/* @__PURE__ */ jsx("path", { d: "M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z" }),
|
|
6031
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "10", r: "3" })
|
|
6032
|
+
]
|
|
6033
|
+
}
|
|
6034
|
+
),
|
|
6035
|
+
/* @__PURE__ */ jsx("span", { className: "crow-truncate", children: contextLabel })
|
|
6036
|
+
]
|
|
6037
|
+
}
|
|
6038
|
+
),
|
|
5913
6039
|
/* @__PURE__ */ jsxs(AnimatePresence, { children: [
|
|
5914
6040
|
showConversationList && isVerifiedUser && /* @__PURE__ */ jsx(
|
|
5915
6041
|
ConversationList,
|
|
@@ -5994,7 +6120,10 @@ function CrowCopilot({
|
|
|
5994
6120
|
onSend: handleSend,
|
|
5995
6121
|
onStop: handleStop,
|
|
5996
6122
|
placeholder: "Ask anything...",
|
|
5997
|
-
isLoading: chat.isLoading
|
|
6123
|
+
isLoading: chat.isLoading,
|
|
6124
|
+
selectedModel: chat.selectedModel || selectedModel,
|
|
6125
|
+
onModelChange: chat.setSelectedModel,
|
|
6126
|
+
availableModels: modelSelectionEnabled ? availableModelsFromAPI : []
|
|
5998
6127
|
}
|
|
5999
6128
|
)
|
|
6000
6129
|
]
|