@lastbrain/ai-ui-react 1.0.63 → 1.0.65
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/components/AiChipLabel.d.ts.map +1 -1
- package/dist/components/AiChipLabel.js +1 -1
- package/dist/components/AiInput.d.ts +1 -1
- package/dist/components/AiInput.d.ts.map +1 -1
- package/dist/components/AiInput.js +16 -2
- package/dist/components/AiPromptPanel.d.ts +1 -0
- package/dist/components/AiPromptPanel.d.ts.map +1 -1
- package/dist/components/AiPromptPanel.js +39 -9
- package/dist/components/AiStatusButton.d.ts.map +1 -1
- package/dist/components/AiStatusButton.js +81 -12
- package/dist/components/AiTextarea.d.ts +1 -1
- package/dist/components/AiTextarea.d.ts.map +1 -1
- package/dist/components/AiTextarea.js +16 -2
- package/dist/context/LBAuthProvider.d.ts.map +1 -1
- package/dist/context/LBAuthProvider.js +143 -182
- package/dist/hooks/usePrompts.d.ts.map +1 -1
- package/dist/hooks/usePrompts.js +12 -4
- package/dist/utils/modelManagement.d.ts.map +1 -1
- package/dist/utils/modelManagement.js +23 -8
- package/package.json +2 -2
- package/src/components/AiChipLabel.tsx +2 -0
- package/src/components/AiInput.tsx +18 -2
- package/src/components/AiPromptPanel.tsx +50 -9
- package/src/components/AiStatusButton.tsx +127 -13
- package/src/components/AiTextarea.tsx +18 -2
- package/src/context/LBAuthProvider.tsx +151 -208
- package/src/hooks/usePrompts.ts +11 -4
- package/src/utils/modelManagement.ts +25 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiChipLabel.d.ts","sourceRoot":"","sources":["../../src/components/AiChipLabel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAW/D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IACvD,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Aa,CAAC;CAC7B;AAED,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAmB,EACnB,SAAS,EACT,KAAK,EAAE,WAAW,GACnB,EAAE,gBAAgB,2CAgClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAU,EACV,QAAQ,EACR,WAAoE,EACpE,OAAO,EACP,QAAQ,EACR,eAAuB,EACvB,SAAS,EACT,YAAY,EACZ,aAAa,EACb,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,YAAY,GACvB,EAAE,gBAAgB,2CA+NlB"}
|
|
@@ -182,5 +182,5 @@ Exemple de réponse attendue: javascript, react, frontend, api, development`;
|
|
|
182
182
|
color: "currentColor",
|
|
183
183
|
opacity: 0.7,
|
|
184
184
|
}, title: "Supprimer", children: _jsx(X, { size: 14 }) })] }, index));
|
|
185
|
-
}) })), _jsx(AiPromptPanel, { isOpen: showPromptPanel, onClose: () => setShowPromptPanel(false), onSubmit: handlePromptSubmit, models: models || undefined, baseUrl: baseUrl, sourceText: context ? `Contexte: ${context}` : undefined }), _jsx(LBSigninModal, { isOpen: showSigninModal, onClose: () => setShowSigninModal(false) })] }));
|
|
185
|
+
}) })), _jsx(AiPromptPanel, { isOpen: showPromptPanel, onClose: () => setShowPromptPanel(false), onSubmit: handlePromptSubmit, models: models || undefined, baseUrl: baseUrl, sourceText: context ? `Contexte: ${context}` : undefined, enableModelManagement: true, showOnlyUserModels: true }), _jsx(LBSigninModal, { isOpen: showSigninModal, onClose: () => setShowSigninModal(false) })] }));
|
|
186
186
|
}
|
|
@@ -4,5 +4,5 @@ export interface AiInputProps extends Omit<BaseAiProps, "type">, Omit<InputHTMLA
|
|
|
4
4
|
uiMode?: "modal" | "drawer";
|
|
5
5
|
enableModelManagement?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare function AiInput({ baseUrl, apiKeyId, uiMode, context, model, prompt, editMode, enableModelManagement, storeOutputs, artifactTitle, onValue, onToast, disabled, className, ...inputProps }: AiInputProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function AiInput({ baseUrl: propBaseUrl, apiKeyId: propApiKeyId, uiMode, context, model, prompt, editMode, enableModelManagement, storeOutputs, artifactTitle, onValue, onToast, disabled, className, ...inputProps }: AiInputProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
//# sourceMappingURL=AiInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiInput.d.ts","sourceRoot":"","sources":["../../src/components/AiInput.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAoB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"AiInput.d.ts","sourceRoot":"","sources":["../../src/components/AiInput.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAoB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAW5C,MAAM,WAAW,YACf,SACE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EACzB,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,SAAS,CAAC;IACxD,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC5B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,YAAY,EACtB,MAAgB,EAChB,OAAO,EACP,KAAK,EACL,MAAM,EACN,QAAgB,EAChB,qBAA4B,EAC5B,YAAY,EACZ,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,GAAG,UAAU,EACd,EAAE,YAAY,2CAwOd"}
|
|
@@ -10,7 +10,8 @@ import { aiStyles } from "../styles/inline";
|
|
|
10
10
|
import { handleAIError } from "../utils/errorHandler";
|
|
11
11
|
import { useLB } from "../context/LBAuthProvider";
|
|
12
12
|
import { LBSigninModal } from "./LBSigninModal";
|
|
13
|
-
|
|
13
|
+
import { useAiContext } from "../context/AiProvider";
|
|
14
|
+
export function AiInput({ baseUrl: propBaseUrl, apiKeyId: propApiKeyId, uiMode = "modal", context, model, prompt, editMode = false, enableModelManagement = true, storeOutputs, artifactTitle, onValue, onToast, disabled, className, ...inputProps }) {
|
|
14
15
|
const [isOpen, setIsOpen] = useState(false);
|
|
15
16
|
const [showAuthModal, setShowAuthModal] = useState(false);
|
|
16
17
|
const [inputValue, setInputValue] = useState(inputProps.value?.toString() || inputProps.defaultValue?.toString() || "");
|
|
@@ -28,6 +29,19 @@ export function AiInput({ baseUrl, apiKeyId, uiMode = "modal", context, model, p
|
|
|
28
29
|
// LBProvider n'est pas disponible, ignorer
|
|
29
30
|
lbStatus = undefined;
|
|
30
31
|
}
|
|
32
|
+
let ctxBaseUrl;
|
|
33
|
+
let ctxApiKeyId;
|
|
34
|
+
try {
|
|
35
|
+
const aiContext = useAiContext();
|
|
36
|
+
ctxBaseUrl = aiContext.baseUrl;
|
|
37
|
+
ctxApiKeyId = aiContext.apiKeyId;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
ctxBaseUrl = undefined;
|
|
41
|
+
ctxApiKeyId = undefined;
|
|
42
|
+
}
|
|
43
|
+
const baseUrl = propBaseUrl ?? ctxBaseUrl;
|
|
44
|
+
const apiKeyId = propApiKeyId ?? ctxApiKeyId;
|
|
31
45
|
const { models } = useAiModels({
|
|
32
46
|
baseUrl,
|
|
33
47
|
apiKeyId,
|
|
@@ -132,5 +146,5 @@ export function AiInput({ baseUrl, apiKeyId, uiMode = "modal", context, model, p
|
|
|
132
146
|
? "Authentication required"
|
|
133
147
|
: hasConfiguration
|
|
134
148
|
? "Generate with AI"
|
|
135
|
-
: "Setup AI", children: loading ? (_jsx("svg", { style: aiStyles.spinner, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83" }) })) : shouldShowSparkles ? (_jsx(Sparkles, { size: 16 })) : (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }), _jsx("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })] })) }), isOpen && (_jsx(AiPromptPanel, { isOpen: isOpen, onClose: handleClosePanel, onSubmit: handleSubmit, uiMode: uiMode, models: [], modelCategory: "text", sourceText: inputValue || undefined, apiKey: apiKeyId, baseUrl: baseUrl, enableModelManagement: enableModelManagement })), _jsx(LBSigninModal, { isOpen: showAuthModal, onClose: () => setShowAuthModal(false) }), Boolean(toastData) && (_jsx(UsageToast, { result: toastData, position: "bottom-right", onComplete: clearToast }, toastKey))] }));
|
|
149
|
+
: "Setup AI", children: loading ? (_jsx("svg", { style: aiStyles.spinner, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83" }) })) : shouldShowSparkles ? (_jsx(Sparkles, { size: 16 })) : (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }), _jsx("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })] })) }), isOpen && (_jsx(AiPromptPanel, { isOpen: isOpen, onClose: handleClosePanel, onSubmit: handleSubmit, uiMode: uiMode, models: [], modelCategory: "text", sourceText: inputValue || undefined, apiKey: apiKeyId, baseUrl: baseUrl, enableModelManagement: enableModelManagement, showOnlyUserModels: true })), _jsx(LBSigninModal, { isOpen: showAuthModal, onClose: () => setShowAuthModal(false) }), Boolean(toastData) && (_jsx(UsageToast, { result: toastData, position: "bottom-right", onComplete: clearToast }, toastKey))] }));
|
|
136
150
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiPromptPanel.d.ts","sourceRoot":"","sources":["../../src/components/AiPromptPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AASvC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,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rompts, } from "../hooks/usePrompts";
|
|
8
8
|
import { useModelManagement } from "../hooks/useModelManagement";
|
|
9
|
-
import { AiProvider } from "../context/AiProvider";
|
|
9
|
+
import { AiProvider, useAiContext } from "../context/AiProvider";
|
|
10
10
|
export function AiPromptPanel(props) {
|
|
11
11
|
const { apiKey, baseUrl } = props;
|
|
12
|
-
|
|
12
|
+
let hasContext = false;
|
|
13
|
+
try {
|
|
14
|
+
useAiContext();
|
|
15
|
+
hasContext = true;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
hasContext = false;
|
|
19
|
+
}
|
|
20
|
+
// Si un contexte existe déjà, ne pas re-wrapper (évite les refetch multiples).
|
|
21
|
+
if (hasContext) {
|
|
22
|
+
return _jsx(AiPromptPanelInternal, { ...props });
|
|
23
|
+
}
|
|
24
|
+
// Sinon, si apiKey/baseUrl sont fournis, wrapper avec AiProvider
|
|
13
25
|
if (apiKey || baseUrl) {
|
|
14
26
|
return (_jsx(AiProvider, { baseUrl: baseUrl || "", apiKeyId: apiKey || "", children: _jsx(AiPromptPanelInternal, { ...props }) }));
|
|
15
27
|
}
|
|
16
28
|
// Sinon, utiliser le contexte existant
|
|
17
29
|
return _jsx(AiPromptPanelInternal, { ...props });
|
|
18
30
|
}
|
|
19
|
-
function AiPromptPanelInternal({ isOpen, onClose, onSubmit, uiMode: _uiMode = "modal", models = [], sourceText, children, enableModelManagement = true, modelCategory = "text", availableModels = [], userModels = [], onModelToggle, apiKey, baseUrl, }) {
|
|
31
|
+
function AiPromptPanelInternal({ isOpen, onClose, onSubmit, uiMode: _uiMode = "modal", models = [], sourceText, children, enableModelManagement = true, modelCategory = "text", availableModels = [], userModels = [], onModelToggle, apiKey, baseUrl, showOnlyUserModels = false, }) {
|
|
20
32
|
const [selectedModel, setSelectedModel] = useState("");
|
|
21
33
|
const [prompt, setPrompt] = useState("");
|
|
22
34
|
const [promptId, setPromptId] = useState(undefined);
|
|
@@ -90,13 +102,16 @@ function AiPromptPanelInternal({ isOpen, onClose, onSubmit, uiMode: _uiMode = "m
|
|
|
90
102
|
}));
|
|
91
103
|
}
|
|
92
104
|
const categoryModels = effectiveAvailableModels.filter((m) => m.category === modelCategory);
|
|
105
|
+
if (!showAllModels && showOnlyUserModels) {
|
|
106
|
+
return categoryModels.filter((m) => effectiveUserModels.includes(m.id));
|
|
107
|
+
}
|
|
93
108
|
if (showAllModels) {
|
|
94
109
|
return categoryModels;
|
|
95
110
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
111
|
+
const enabledModels = categoryModels.filter((m) => effectiveUserModels.includes(m.id));
|
|
112
|
+
return enabledModels.length > 0 ? enabledModels : categoryModels;
|
|
99
113
|
};
|
|
114
|
+
const modelOptions = getFilteredModels();
|
|
100
115
|
// Fetch prompts when modal opens
|
|
101
116
|
useEffect(() => {
|
|
102
117
|
if (isOpen && (models.length > 0 || enableModelManagement)) {
|
|
@@ -117,7 +132,7 @@ function AiPromptPanelInternal({ isOpen, onClose, onSubmit, uiMode: _uiMode = "m
|
|
|
117
132
|
modelCategory,
|
|
118
133
|
]);
|
|
119
134
|
const handleSubmit = async () => {
|
|
120
|
-
const activeModelId = selectedModel ||
|
|
135
|
+
const activeModelId = selectedModel || modelOptions[0]?.id;
|
|
121
136
|
if (!activeModelId || !prompt.trim())
|
|
122
137
|
return;
|
|
123
138
|
setIsGenerating(true);
|
|
@@ -156,6 +171,19 @@ function AiPromptPanelInternal({ isOpen, onClose, onSubmit, uiMode: _uiMode = "m
|
|
|
156
171
|
}
|
|
157
172
|
};
|
|
158
173
|
}, []);
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
if (!isOpen) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (modelOptions.length === 0) {
|
|
179
|
+
setSelectedModel("");
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const hasSelected = modelOptions.some((model) => model.id === selectedModel);
|
|
183
|
+
if (!hasSelected) {
|
|
184
|
+
setSelectedModel(modelOptions[0].id);
|
|
185
|
+
}
|
|
186
|
+
}, [isOpen, modelOptions, selectedModel]);
|
|
159
187
|
const handleKeyDown = (e) => {
|
|
160
188
|
if (e.key === "Escape") {
|
|
161
189
|
handleClose();
|
|
@@ -186,7 +214,7 @@ function AiPromptPanelInternal({ isOpen, onClose, onSubmit, uiMode: _uiMode = "m
|
|
|
186
214
|
}, [prompt]);
|
|
187
215
|
if (!isOpen)
|
|
188
216
|
return null;
|
|
189
|
-
const activeModelId = selectedModel ||
|
|
217
|
+
const activeModelId = selectedModel || modelOptions[0]?.id || "";
|
|
190
218
|
const currentModelType = models.find((m) => m.id === activeModelId)?.type;
|
|
191
219
|
const filteredPrompts = prompts.filter((p) => {
|
|
192
220
|
const matchesType = currentModelType === "image" ? p.type === "image" : p.type !== "image";
|
|
@@ -337,7 +365,9 @@ function AiPromptPanelInternal({ isOpen, onClose, onSubmit, uiMode: _uiMode = "m
|
|
|
337
365
|
!effectiveUserModels.includes(m.id)).length] }))] }))] }), _jsxs("select", { id: "model-select", value: activeModelId, onChange: (e) => setSelectedModel(e.target.value), onFocus: () => setModelFocused(true), onBlur: () => setModelFocused(false), style: {
|
|
338
366
|
...aiStyles.select,
|
|
339
367
|
...(modelFocused && aiStyles.selectFocus),
|
|
340
|
-
}, children: [
|
|
368
|
+
}, children: [modelOptions.length === 0 && (_jsx("option", { value: "", children: showOnlyUserModels
|
|
369
|
+
? "No active models. Open 'Gérer les modèles'."
|
|
370
|
+
: "Loading models..." })), modelOptions.map((model) => {
|
|
341
371
|
const isActive = effectiveUserModels.includes(model.id);
|
|
342
372
|
return (_jsxs("option", { value: model.id, style: {
|
|
343
373
|
opacity: showAllModels && !isActive ? 0.6 : 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiStatusButton.d.ts","sourceRoot":"","sources":["../../src/components/AiStatusButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAmBtD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,OAAe,EACf,SAAc,GACf,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"AiStatusButton.d.ts","sourceRoot":"","sources":["../../src/components/AiStatusButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAmBtD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,OAAe,EACf,SAAc,GACf,EAAE,mBAAmB,2CAssCrB"}
|
|
@@ -22,6 +22,9 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
|
|
|
22
22
|
let lbStorageStatus = null;
|
|
23
23
|
let lbIsLoadingStatus = false;
|
|
24
24
|
let lbIsLoadingStorage = false;
|
|
25
|
+
let lbSelectedKey = null;
|
|
26
|
+
let lbRefreshBasicStatus;
|
|
27
|
+
let lbRefreshStorageStatus;
|
|
25
28
|
try {
|
|
26
29
|
const lbContext = useLB();
|
|
27
30
|
lbStatus = lbContext.status;
|
|
@@ -36,6 +39,9 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
|
|
|
36
39
|
lbStorageStatus = lbContext.storageStatus;
|
|
37
40
|
lbIsLoadingStatus = lbContext.isLoadingStatus || false;
|
|
38
41
|
lbIsLoadingStorage = lbContext.isLoadingStorage || false;
|
|
42
|
+
lbSelectedKey = lbContext.selectedKey || null;
|
|
43
|
+
lbRefreshBasicStatus = lbContext.refreshBasicStatus;
|
|
44
|
+
lbRefreshStorageStatus = lbContext.refreshStorageStatus;
|
|
39
45
|
}
|
|
40
46
|
catch {
|
|
41
47
|
// LBProvider n'est pas disponible, ignorer
|
|
@@ -43,13 +49,16 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
|
|
|
43
49
|
user = undefined;
|
|
44
50
|
logout = undefined;
|
|
45
51
|
}
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
// Toujours prioriser les données du contexte LB quand disponibles
|
|
53
|
+
// pour éviter d'afficher un status externe obsolète (Unknown/0).
|
|
54
|
+
const lbEffectiveStatus = lbStatus === "ready"
|
|
55
|
+
? {
|
|
56
|
+
...(lbApiStatus || {}),
|
|
57
|
+
...(lbBasicStatus || {}),
|
|
58
|
+
storage: lbStorageStatus?.storage || lbApiStatus?.storage,
|
|
59
|
+
}
|
|
60
|
+
: null;
|
|
61
|
+
const effectiveStatus = lbEffectiveStatus || status || null;
|
|
53
62
|
// Récupérer refetchProviders depuis AiProvider si disponible
|
|
54
63
|
let refetchProviders;
|
|
55
64
|
try {
|
|
@@ -64,7 +73,6 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
|
|
|
64
73
|
const [showApiKeySelector, setShowApiKeySelector] = useState(false);
|
|
65
74
|
const [isSelectingApiKey, setIsSelectingApiKey] = useState(false);
|
|
66
75
|
const [isLoadingStatus, setIsLoadingStatus] = useState(false);
|
|
67
|
-
const formatNumber = (value) => typeof value === "number" ? value.toLocaleString() : "0";
|
|
68
76
|
const formatFixed = (value, digits) => typeof value === "number" ? value.toFixed(digits) : "0.00";
|
|
69
77
|
const formatStorage = (valueMb) => {
|
|
70
78
|
const mb = typeof valueMb === "number" ? valueMb : 0;
|
|
@@ -97,9 +105,11 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
|
|
|
97
105
|
};
|
|
98
106
|
const balanceUsage = effectiveStatus?.balance;
|
|
99
107
|
const storageUsage = effectiveStatus?.storage;
|
|
100
|
-
const
|
|
108
|
+
const balanceUsed = safeNumber(balanceUsage?.used);
|
|
109
|
+
const balanceRemaining = safeNumber(balanceUsage?.remaining);
|
|
110
|
+
const rawBalanceTotal = balanceUsage?.total ??
|
|
101
111
|
safeNumber(balanceUsage?.purchased) + safeNumber(balanceUsage?.quota);
|
|
102
|
-
const
|
|
112
|
+
const balanceTotal = rawBalanceTotal > 0 ? rawBalanceTotal : balanceUsed + balanceRemaining;
|
|
103
113
|
const balancePercentage = balanceUsage?.percentage ??
|
|
104
114
|
(balanceTotal > 0 ? Math.round((balanceUsed / balanceTotal) * 100) : 0);
|
|
105
115
|
const storageAllocated = storageUsage?.allocated_mb ?? storageUsage?.total_mb ?? 0;
|
|
@@ -114,6 +124,8 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
|
|
|
114
124
|
const buttonRef = useRef(null);
|
|
115
125
|
const tooltipRef = useRef(null);
|
|
116
126
|
const canPortal = typeof document !== "undefined";
|
|
127
|
+
const hasApiKeySelected = Boolean(effectiveStatus?.apiKey?.id || effectiveStatus?.api_key?.id || lbSelectedKey?.id);
|
|
128
|
+
const requiresApiKeySelection = lbStatus === "ready" && !hasApiKeySelected && apiKeys.length > 0;
|
|
117
129
|
useLayoutEffect(() => {
|
|
118
130
|
if (!showTooltip || !buttonRef.current) {
|
|
119
131
|
return;
|
|
@@ -178,10 +190,16 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
|
|
|
178
190
|
};
|
|
179
191
|
}, [showTooltip, canPortal]);
|
|
180
192
|
const handleMouseEnter = () => {
|
|
193
|
+
if (requiresApiKeySelection) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
181
196
|
setShowTooltip(true);
|
|
182
197
|
setIsHovered(true);
|
|
183
198
|
};
|
|
184
199
|
const handleMouseLeave = () => {
|
|
200
|
+
if (requiresApiKeySelection) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
185
203
|
// Keep tooltip visible if hovering over it
|
|
186
204
|
setTimeout(() => {
|
|
187
205
|
if (!tooltipRef.current?.matches(":hover") &&
|
|
@@ -191,12 +209,61 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
|
|
|
191
209
|
}
|
|
192
210
|
}, 100);
|
|
193
211
|
};
|
|
194
|
-
|
|
212
|
+
useLayoutEffect(() => {
|
|
213
|
+
if (!showTooltip || requiresApiKeySelection || lbStatus !== "ready") {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (!lbBasicStatus && !lbIsLoadingStatus && lbRefreshBasicStatus) {
|
|
217
|
+
lbRefreshBasicStatus().catch(() => undefined);
|
|
218
|
+
}
|
|
219
|
+
if (!lbStorageStatus?.storage &&
|
|
220
|
+
!lbIsLoadingStorage &&
|
|
221
|
+
lbRefreshStorageStatus) {
|
|
222
|
+
lbRefreshStorageStatus().catch(() => undefined);
|
|
223
|
+
}
|
|
224
|
+
}, [
|
|
225
|
+
showTooltip,
|
|
226
|
+
requiresApiKeySelection,
|
|
227
|
+
lbStatus,
|
|
228
|
+
lbBasicStatus,
|
|
229
|
+
lbStorageStatus,
|
|
230
|
+
lbIsLoadingStatus,
|
|
231
|
+
lbIsLoadingStorage,
|
|
232
|
+
lbRefreshBasicStatus,
|
|
233
|
+
lbRefreshStorageStatus,
|
|
234
|
+
]);
|
|
235
|
+
if (loading ||
|
|
236
|
+
isSelectingApiKey ||
|
|
237
|
+
((isLoadingStatus || lbIsLoadingStatus) && !effectiveStatus)) {
|
|
195
238
|
return (_jsx("button", { ref: buttonRef, style: {
|
|
196
239
|
...aiStyles.statusButton,
|
|
197
240
|
...aiStyles.statusButtonDisabled,
|
|
198
241
|
}, className: className, disabled: true, children: _jsx("svg", { style: aiStyles.spinner, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83" }) }) }));
|
|
199
242
|
}
|
|
243
|
+
if (requiresApiKeySelection) {
|
|
244
|
+
return (_jsxs("div", { style: { position: "relative", display: "inline-block" }, children: [_jsx("button", { ref: buttonRef, style: {
|
|
245
|
+
...aiStyles.statusButton,
|
|
246
|
+
color: "#f59e0b",
|
|
247
|
+
...(isHovered && aiStyles.statusButtonHover),
|
|
248
|
+
}, className: className, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onClick: () => setShowApiKeySelector(true), title: "Select an API key to enable AI status and generation", children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: _jsx("polyline", { points: "22 12 18 12 15 21 9 3 6 12 2 12" }) }) }), showApiKeySelector && apiKeys.length > 0 && (_jsx(LBApiKeySelector, { isOpen: showApiKeySelector, apiKeys: apiKeys, onSelect: async (keyId) => {
|
|
249
|
+
setIsSelectingApiKey(true);
|
|
250
|
+
try {
|
|
251
|
+
if (switchApiKey) {
|
|
252
|
+
await switchApiKey(keyId);
|
|
253
|
+
}
|
|
254
|
+
setShowApiKeySelector(false);
|
|
255
|
+
if (refetchProviders) {
|
|
256
|
+
await refetchProviders();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
console.error("Failed to select API key:", error);
|
|
261
|
+
}
|
|
262
|
+
finally {
|
|
263
|
+
setIsSelectingApiKey(false);
|
|
264
|
+
}
|
|
265
|
+
}, onCancel: () => setShowApiKeySelector(false) }))] }));
|
|
266
|
+
}
|
|
200
267
|
if (!effectiveStatus) {
|
|
201
268
|
// Si pas de statut API et pas de LBProvider, afficher message simple
|
|
202
269
|
if (!lbStatus && lbStatus !== "ready") {
|
|
@@ -434,7 +501,9 @@ export function AiStatusButton({ status, loading = false, className = "", }) {
|
|
|
434
501
|
effectiveStatus.api_key?.env ||
|
|
435
502
|
"N/A" })] }), _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "Rate Limit:" }), _jsxs("span", { style: aiStyles.tooltipValue, children: [effectiveStatus.apiKey?.rate_limit_rpm ||
|
|
436
503
|
effectiveStatus.api_key?.rate_limit_rpm ||
|
|
437
|
-
0, " ", "req/min"] })] })
|
|
504
|
+
0, " ", "req/min"] })] }), _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "Auth:" }), _jsx("span", { style: aiStyles.tooltipValue, children: lbIsLoadingStatus
|
|
505
|
+
? "..."
|
|
506
|
+
: effectiveStatus?.authType || lbStatus || "unknown" })] })] }), _jsxs("div", { style: aiStyles.tooltipSection, children: [_jsx("div", { style: aiStyles.tooltipSubtitle, children: "Wallet" }), _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "Total:" }), _jsxs("span", { style: aiStyles.tooltipValue, children: ["$", formatFixed(balanceUsed, 2), " / $", formatFixed(balanceTotal, 2)] }), renderUsageCircle(balancePercentage)] })] }), _jsxs("div", { style: aiStyles.tooltipSection, children: [_jsx("div", { style: aiStyles.tooltipSubtitle, children: "Storage" }), _jsxs("div", { style: aiStyles.tooltipRow, children: [_jsx("span", { style: aiStyles.tooltipLabel, children: "Total:" }), lbIsLoadingStorage ? (_jsxs("div", { style: {
|
|
438
507
|
display: "flex",
|
|
439
508
|
alignItems: "center",
|
|
440
509
|
gap: "8px",
|
|
@@ -3,5 +3,5 @@ import type { BaseAiProps } from "../types";
|
|
|
3
3
|
export interface AiTextareaProps extends Omit<BaseAiProps, "type">, Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "onValue"> {
|
|
4
4
|
uiMode?: "modal" | "drawer";
|
|
5
5
|
}
|
|
6
|
-
export declare function AiTextarea({ baseUrl, apiKeyId, uiMode, context, model, prompt, editMode, enableModelManagement, storeOutputs, artifactTitle, onValue, onToast, disabled, className, ...textareaProps }: AiTextareaProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function AiTextarea({ baseUrl: propBaseUrl, apiKeyId: propApiKeyId, uiMode, context, model, prompt, editMode, enableModelManagement, storeOutputs, artifactTitle, onValue, onToast, disabled, className, ...textareaProps }: AiTextareaProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
//# sourceMappingURL=AiTextarea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiTextarea.d.ts","sourceRoot":"","sources":["../../src/components/AiTextarea.tsx"],"names":[],"mappings":"AAEA,OAAc,EAIZ,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"AiTextarea.d.ts","sourceRoot":"","sources":["../../src/components/AiTextarea.tsx"],"names":[],"mappings":"AAEA,OAAc,EAIZ,KAAK,sBAAsB,EAC5B,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAW5C,MAAM,WAAW,eACf,SACE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EACzB,IAAI,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAC9D,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC7B;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,YAAY,EACtB,MAAgB,EAChB,OAAO,EACP,KAAK,EACL,MAAM,EACN,QAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,GAAG,aAAa,EACjB,EAAE,eAAe,2CA+OjB"}
|
|
@@ -10,7 +10,8 @@ import { aiStyles } from "../styles/inline";
|
|
|
10
10
|
import { handleAIError } from "../utils/errorHandler";
|
|
11
11
|
import { useLB } from "../context/LBAuthProvider";
|
|
12
12
|
import { LBSigninModal } from "./LBSigninModal";
|
|
13
|
-
|
|
13
|
+
import { useAiContext } from "../context/AiProvider";
|
|
14
|
+
export function AiTextarea({ baseUrl: propBaseUrl, apiKeyId: propApiKeyId, uiMode = "modal", context, model, prompt, editMode = false, enableModelManagement, storeOutputs, artifactTitle, onValue, onToast, disabled, className, ...textareaProps }) {
|
|
14
15
|
const [isOpen, setIsOpen] = useState(false);
|
|
15
16
|
const [showAuthModal, setShowAuthModal] = useState(false);
|
|
16
17
|
const [textareaValue, setTextareaValue] = useState(textareaProps.value?.toString() ||
|
|
@@ -30,6 +31,19 @@ export function AiTextarea({ baseUrl, apiKeyId, uiMode = "modal", context, model
|
|
|
30
31
|
// LBProvider n'est pas disponible, ignorer
|
|
31
32
|
lbStatus = undefined;
|
|
32
33
|
}
|
|
34
|
+
let ctxBaseUrl;
|
|
35
|
+
let ctxApiKeyId;
|
|
36
|
+
try {
|
|
37
|
+
const aiContext = useAiContext();
|
|
38
|
+
ctxBaseUrl = aiContext.baseUrl;
|
|
39
|
+
ctxApiKeyId = aiContext.apiKeyId;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
ctxBaseUrl = undefined;
|
|
43
|
+
ctxApiKeyId = undefined;
|
|
44
|
+
}
|
|
45
|
+
const baseUrl = propBaseUrl ?? ctxBaseUrl;
|
|
46
|
+
const apiKeyId = propApiKeyId ?? ctxApiKeyId;
|
|
33
47
|
const { models } = useAiModels({
|
|
34
48
|
baseUrl,
|
|
35
49
|
apiKeyId,
|
|
@@ -146,5 +160,5 @@ export function AiTextarea({ baseUrl, apiKeyId, uiMode = "modal", context, model
|
|
|
146
160
|
? "Authentication required"
|
|
147
161
|
: hasConfiguration
|
|
148
162
|
? "Generate with AI"
|
|
149
|
-
: "Setup AI", children: loading ? (_jsx("svg", { style: aiStyles.spinner, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83" }) })) : shouldShowSparkles ? (_jsx(Sparkles, { size: 16 })) : (_jsx(Lock, { size: 16 })) }), isOpen && (_jsx(AiPromptPanel, { isOpen: isOpen, onClose: handleClosePanel, onSubmit: handleSubmit, uiMode: uiMode, models: [], modelCategory: "text", sourceText: textareaValue || undefined, baseUrl: baseUrl, apiKey: apiKeyId, enableModelManagement: enableModelManagement })), Boolean(toastData) && (_jsx(UsageToast, { result: toastData, position: "bottom-right", onComplete: clearToast }, toastKey)), _jsx(LBSigninModal, { isOpen: showAuthModal, onClose: () => setShowAuthModal(false) })] }));
|
|
163
|
+
: "Setup AI", children: loading ? (_jsx("svg", { style: aiStyles.spinner, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83" }) })) : shouldShowSparkles ? (_jsx(Sparkles, { size: 16 })) : (_jsx(Lock, { size: 16 })) }), isOpen && (_jsx(AiPromptPanel, { isOpen: isOpen, onClose: handleClosePanel, onSubmit: handleSubmit, uiMode: uiMode, models: [], modelCategory: "text", sourceText: textareaValue || undefined, baseUrl: baseUrl, apiKey: apiKeyId, enableModelManagement: enableModelManagement, showOnlyUserModels: true })), Boolean(toastData) && (_jsx(UsageToast, { result: toastData, position: "bottom-right", onComplete: clearToast }, toastKey)), _jsx(LBSigninModal, { isOpen: showAuthModal, onClose: () => setShowAuthModal(false) })] }));
|
|
150
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LBAuthProvider.d.ts","sourceRoot":"","sources":["../../src/context/LBAuthProvider.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"LBAuthProvider.d.ts","sourceRoot":"","sources":["../../src/context/LBAuthProvider.tsx"],"names":[],"mappings":"AAEA;;;GAG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