@lastbrain/ai-ui-react 1.0.44 → 1.0.46
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/LBApiKeySelector.d.ts.map +1 -1
- package/dist/components/LBSigninModal.d.ts.map +1 -1
- package/dist/context/LBAuthProvider.d.ts.map +1 -1
- package/dist/context/LBAuthProvider.js +19 -2
- package/dist/hooks/usePrompts.js +6 -6
- package/dist/utils/modelManagement.js +2 -2
- package/package.json +2 -2
- package/src/components/LBApiKeySelector.tsx +1 -2
- package/src/components/LBSigninModal.tsx +5 -1
- package/src/context/LBAuthProvider.tsx +56 -12
- package/src/hooks/usePrompts.ts +6 -6
- package/src/utils/modelManagement.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LBApiKeySelector.d.ts","sourceRoot":"","sources":["../../src/components/LBApiKeySelector.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,UAAU,qBAAqB;IAC7B,OAAO,EAAE,QAAQ,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,GACP,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"LBApiKeySelector.d.ts","sourceRoot":"","sources":["../../src/components/LBApiKeySelector.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,UAAU,qBAAqB;IAC7B,OAAO,EAAE,QAAQ,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,GACP,EAAE,qBAAqB,kDA0TvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LBSigninModal.d.ts","sourceRoot":"","sources":["../../src/components/LBSigninModal.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"LBSigninModal.d.ts","sourceRoot":"","sources":["../../src/components/LBSigninModal.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,kDA8bpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LBAuthProvider.d.ts","sourceRoot":"","sources":["../../src/context/LBAuthProvider.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EAIT,MAAM,uBAAuB,CAAC;AAE/B,UAAU,eAAe;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;CAC1D;AAED,UAAU,cAAe,SAAQ,WAAW;IAC1C,4BAA4B;IAC5B,KAAK,EAAE,CACL,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LBAuthProvider.d.ts","sourceRoot":"","sources":["../../src/context/LBAuthProvider.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EAIT,MAAM,uBAAuB,CAAC;AAE/B,UAAU,eAAe;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;CAC1D;AAED,UAAU,cAAe,SAAQ,WAAW;IAC1C,4BAA4B;IAC5B,KAAK,EAAE,CACL,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC;QACX,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAC7B,CAAC,CAAC;IACH,8BAA8B;IAC9B,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,6CAA6C;IAC7C,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3D,gEAAgE;IAChE,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvE,mDAAmD;IACnD,qBAAqB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,oCAAoC;IACpC,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,2BAA2B;IAC3B,OAAO,EAAE,QAAQ,EAAE,CAAC;IACpB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,OAAO,EAAE,QAA2B,EACpC,QAA2B,EAC3B,cAAc,GACf,EAAE,eAAe,2CA0UjB;AAED;;GAEG;AACH,wBAAgB,KAAK,IAAI,cAAc,CAMtC"}
|
|
@@ -151,13 +151,24 @@ export function LBProvider({ children, baseUrl: _baseUrl = "/api/lastbrain", pro
|
|
|
151
151
|
}
|
|
152
152
|
const result = await response.json();
|
|
153
153
|
console.log("[LBProvider] Login successful:", result.user?.email);
|
|
154
|
+
console.log("[LBProvider] Access token received:", result.accessToken ? "YES" : "NO");
|
|
155
|
+
console.log("[LBProvider] Token length:", result.accessToken?.length || 0);
|
|
154
156
|
const token = result.accessToken;
|
|
157
|
+
if (!token) {
|
|
158
|
+
console.error("[LBProvider] No access token in login response!");
|
|
159
|
+
setState({
|
|
160
|
+
status: "needs_auth",
|
|
161
|
+
error: "Token manquant dans la réponse",
|
|
162
|
+
});
|
|
163
|
+
return { success: false, error: "Token manquant dans la réponse" };
|
|
164
|
+
}
|
|
155
165
|
setAccessToken(token);
|
|
156
166
|
setState({
|
|
157
167
|
status: "loading",
|
|
158
168
|
user: result.user,
|
|
159
169
|
});
|
|
160
170
|
// Récupérer les clés API
|
|
171
|
+
console.log("[LBProvider] About to fetch API keys...");
|
|
161
172
|
try {
|
|
162
173
|
const keys = await fetchApiKeys(token);
|
|
163
174
|
console.log("[LBProvider] Fetched keys:", keys.length);
|
|
@@ -186,12 +197,18 @@ export function LBProvider({ children, baseUrl: _baseUrl = "/api/lastbrain", pro
|
|
|
186
197
|
return { success: true, needsKeySelection: true };
|
|
187
198
|
}
|
|
188
199
|
catch (keyError) {
|
|
189
|
-
console.error("[LBProvider] Failed to fetch API keys:"
|
|
200
|
+
console.error("[LBProvider] Failed to fetch API keys:");
|
|
201
|
+
console.error("[LBProvider] Error details:", keyError);
|
|
202
|
+
console.error("[LBProvider] Error message:", keyError instanceof Error ? keyError.message : String(keyError));
|
|
203
|
+
console.error("[LBProvider] Error stack:", keyError instanceof Error ? keyError.stack : "No stack");
|
|
190
204
|
setState({
|
|
191
205
|
status: "needs_auth",
|
|
192
206
|
error: "Impossible de récupérer les clés API",
|
|
193
207
|
});
|
|
194
|
-
return {
|
|
208
|
+
return {
|
|
209
|
+
success: false,
|
|
210
|
+
error: "Impossible de récupérer les clés API",
|
|
211
|
+
};
|
|
195
212
|
}
|
|
196
213
|
}
|
|
197
214
|
catch (error) {
|
package/dist/hooks/usePrompts.js
CHANGED
|
@@ -52,7 +52,7 @@ export function usePrompts() {
|
|
|
52
52
|
let endpoint;
|
|
53
53
|
if (options?.public) {
|
|
54
54
|
endpoint = isExternalProxy
|
|
55
|
-
? `${baseUrl}/
|
|
55
|
+
? `${baseUrl}/public/prompts?${params}`
|
|
56
56
|
: isPublicApi
|
|
57
57
|
? `${baseUrl}/prompts?${params}`
|
|
58
58
|
: baseUrl
|
|
@@ -61,7 +61,7 @@ export function usePrompts() {
|
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
63
|
endpoint = isExternalProxy
|
|
64
|
-
? `${baseUrl}/
|
|
64
|
+
? `${baseUrl}/auth/prompts?${params}`
|
|
65
65
|
: isPublicApi
|
|
66
66
|
? `${baseUrl}/prompts?${params}`
|
|
67
67
|
: baseUrl
|
|
@@ -107,7 +107,7 @@ export function usePrompts() {
|
|
|
107
107
|
setError(null);
|
|
108
108
|
const isExternalProxy = baseUrl && baseUrl.includes("/api/lastbrain");
|
|
109
109
|
const endpoint = isExternalProxy
|
|
110
|
-
? `${baseUrl}/prompts` // Proxy
|
|
110
|
+
? `${baseUrl}/auth/prompts` // Proxy ajoutera /api/ai/
|
|
111
111
|
: "/api/ai/auth/prompts";
|
|
112
112
|
const headers = { "Content-Type": "application/json" };
|
|
113
113
|
if (!isExternalProxy && apiKeyId) {
|
|
@@ -141,7 +141,7 @@ export function usePrompts() {
|
|
|
141
141
|
const isExternalProxy = baseUrl && baseUrl.includes("/api/lastbrain");
|
|
142
142
|
const isPublicApi = baseUrl && baseUrl.includes("/api/public/v1");
|
|
143
143
|
const endpoint = isExternalProxy
|
|
144
|
-
? `${baseUrl}/
|
|
144
|
+
? `${baseUrl}/auth/prompts`
|
|
145
145
|
: isPublicApi
|
|
146
146
|
? `${baseUrl}/prompts`
|
|
147
147
|
: baseUrl
|
|
@@ -179,7 +179,7 @@ export function usePrompts() {
|
|
|
179
179
|
const isExternalProxy = baseUrl && baseUrl.includes("/api/lastbrain");
|
|
180
180
|
const isPublicApi = baseUrl && baseUrl.includes("/api/public/v1");
|
|
181
181
|
const endpoint = isExternalProxy
|
|
182
|
-
? `${baseUrl}/prompts?id=${id}` // Proxy
|
|
182
|
+
? `${baseUrl}/auth/prompts?id=${id}` // Proxy ajoutera /api/ai/
|
|
183
183
|
: isPublicApi
|
|
184
184
|
? `${baseUrl}/prompts?id=${id}`
|
|
185
185
|
: baseUrl
|
|
@@ -215,7 +215,7 @@ export function usePrompts() {
|
|
|
215
215
|
const isExternalProxy = baseUrl && baseUrl.includes("/api/lastbrain");
|
|
216
216
|
const isPublicApi = baseUrl && baseUrl.includes("/api/public/v1");
|
|
217
217
|
const endpoint = isExternalProxy
|
|
218
|
-
? `${baseUrl}/prompts/stats` // Proxy
|
|
218
|
+
? `${baseUrl}/auth/prompts/stats` // Proxy ajoutera /api/ai/
|
|
219
219
|
: isPublicApi
|
|
220
220
|
? `${baseUrl}/prompts/stats`
|
|
221
221
|
: baseUrl
|
|
@@ -19,7 +19,7 @@ export async function toggleUserModel(modelId, isActive, options = {}) {
|
|
|
19
19
|
const endpoint = isPublicApi
|
|
20
20
|
? `${baseUrl}/ai/user/models/toggle`
|
|
21
21
|
: isExternalProxy
|
|
22
|
-
? `${baseUrl}/ai
|
|
22
|
+
? `${baseUrl}/auth/ai-models-toggle` // Proxy ajoutera /api/ai/
|
|
23
23
|
: baseUrl
|
|
24
24
|
? `${baseUrl}/auth/ai-models-toggle`
|
|
25
25
|
: `/api/ai/auth/ai-models-toggle`;
|
|
@@ -77,7 +77,7 @@ export async function getUserModels(options = {}) {
|
|
|
77
77
|
const isExternalProxy = baseUrl && baseUrl.includes("/api/lastbrain");
|
|
78
78
|
const isPublicApi = baseUrl && baseUrl.includes("/api/public/v1");
|
|
79
79
|
const endpoint = isExternalProxy
|
|
80
|
-
? `${baseUrl}/
|
|
80
|
+
? `${baseUrl}/auth/user-models` // Proxy ajoutera /api/ai/
|
|
81
81
|
: isPublicApi
|
|
82
82
|
? `${baseUrl}/ai/user/models` // → /api/public/v1/ai/user/models
|
|
83
83
|
: baseUrl
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lastbrain/ai-ui-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"description": "Headless React components for LastBrain AI UI Kit",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"lucide-react": "^0.257.0",
|
|
51
|
-
"@lastbrain/ai-ui-core": "1.0.
|
|
51
|
+
"@lastbrain/ai-ui-core": "1.0.36"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/react": "^19.2.0",
|
|
@@ -302,8 +302,7 @@ export function LBApiKeySelector({
|
|
|
302
302
|
color: "#ffffff",
|
|
303
303
|
fontSize: "14px",
|
|
304
304
|
fontWeight: 600,
|
|
305
|
-
cursor:
|
|
306
|
-
loading || !selectedKeyId ? "not-allowed" : "pointer",
|
|
305
|
+
cursor: loading || !selectedKeyId ? "not-allowed" : "pointer",
|
|
307
306
|
opacity: loading || !selectedKeyId ? 0.5 : 1,
|
|
308
307
|
transition: "all 0.2s ease",
|
|
309
308
|
}}
|
|
@@ -15,7 +15,11 @@ export function LBSigninModal({ isOpen, onClose }: LBSigninModalProps) {
|
|
|
15
15
|
| ((
|
|
16
16
|
email: string,
|
|
17
17
|
password: string
|
|
18
|
-
) => Promise<{
|
|
18
|
+
) => Promise<{
|
|
19
|
+
success: boolean;
|
|
20
|
+
error?: string;
|
|
21
|
+
needsKeySelection?: boolean;
|
|
22
|
+
}>)
|
|
19
23
|
| undefined;
|
|
20
24
|
let selectApiKeyWithToken: ((apiKeyId: string) => Promise<void>) | undefined;
|
|
21
25
|
let apiKeys: any[] = [];
|
|
@@ -36,7 +36,11 @@ interface LBContextValue extends LBAuthState {
|
|
|
36
36
|
login: (
|
|
37
37
|
email: string,
|
|
38
38
|
password: string
|
|
39
|
-
) => Promise<{
|
|
39
|
+
) => Promise<{
|
|
40
|
+
success: boolean;
|
|
41
|
+
error?: string;
|
|
42
|
+
needsKeySelection?: boolean;
|
|
43
|
+
}>;
|
|
40
44
|
/** Fonction de déconnexion */
|
|
41
45
|
logout: () => Promise<void>;
|
|
42
46
|
/** Récupère les clés API de l'utilisateur */
|
|
@@ -108,8 +112,11 @@ export function LBProvider({
|
|
|
108
112
|
const fetchApiKeys = useCallback(
|
|
109
113
|
async (token: string): Promise<LBApiKey[]> => {
|
|
110
114
|
try {
|
|
111
|
-
console.log(
|
|
112
|
-
|
|
115
|
+
console.log(
|
|
116
|
+
"[LBProvider] Fetching API keys with token:",
|
|
117
|
+
token.substring(0, 20) + "..."
|
|
118
|
+
);
|
|
119
|
+
|
|
113
120
|
const response = await fetch(`${proxyUrl}/public/user/api-keys`, {
|
|
114
121
|
headers: {
|
|
115
122
|
Authorization: `Bearer ${token}`,
|
|
@@ -128,7 +135,7 @@ export function LBProvider({
|
|
|
128
135
|
|
|
129
136
|
const data = await response.json();
|
|
130
137
|
console.log("[LBProvider] API keys received:", data);
|
|
131
|
-
|
|
138
|
+
|
|
132
139
|
const keys: LBApiKey[] = data.apiKeys || data;
|
|
133
140
|
setApiKeys(keys);
|
|
134
141
|
return keys;
|
|
@@ -168,7 +175,10 @@ export function LBProvider({
|
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
const sessionResult: LBSessionResult = await response.json();
|
|
171
|
-
console.log(
|
|
178
|
+
console.log(
|
|
179
|
+
"[LBProvider] Session created successfully:",
|
|
180
|
+
sessionResult
|
|
181
|
+
);
|
|
172
182
|
|
|
173
183
|
setState({
|
|
174
184
|
status: "ready",
|
|
@@ -206,7 +216,11 @@ export function LBProvider({
|
|
|
206
216
|
async (
|
|
207
217
|
email: string,
|
|
208
218
|
password: string
|
|
209
|
-
): Promise<{
|
|
219
|
+
): Promise<{
|
|
220
|
+
success: boolean;
|
|
221
|
+
error?: string;
|
|
222
|
+
needsKeySelection?: boolean;
|
|
223
|
+
}> => {
|
|
210
224
|
try {
|
|
211
225
|
console.log("[LBProvider] Login attempt:", email);
|
|
212
226
|
setState((prev: LBAuthState) => ({ ...prev, status: "loading" }));
|
|
@@ -233,8 +247,26 @@ export function LBProvider({
|
|
|
233
247
|
|
|
234
248
|
const result: LBLoginResult = await response.json();
|
|
235
249
|
console.log("[LBProvider] Login successful:", result.user?.email);
|
|
236
|
-
|
|
250
|
+
console.log(
|
|
251
|
+
"[LBProvider] Access token received:",
|
|
252
|
+
result.accessToken ? "YES" : "NO"
|
|
253
|
+
);
|
|
254
|
+
console.log(
|
|
255
|
+
"[LBProvider] Token length:",
|
|
256
|
+
result.accessToken?.length || 0
|
|
257
|
+
);
|
|
258
|
+
|
|
237
259
|
const token = result.accessToken;
|
|
260
|
+
|
|
261
|
+
if (!token) {
|
|
262
|
+
console.error("[LBProvider] No access token in login response!");
|
|
263
|
+
setState({
|
|
264
|
+
status: "needs_auth",
|
|
265
|
+
error: "Token manquant dans la réponse",
|
|
266
|
+
});
|
|
267
|
+
return { success: false, error: "Token manquant dans la réponse" };
|
|
268
|
+
}
|
|
269
|
+
|
|
238
270
|
setAccessToken(token);
|
|
239
271
|
|
|
240
272
|
setState({
|
|
@@ -243,6 +275,7 @@ export function LBProvider({
|
|
|
243
275
|
});
|
|
244
276
|
|
|
245
277
|
// Récupérer les clés API
|
|
278
|
+
console.log("[LBProvider] About to fetch API keys...");
|
|
246
279
|
try {
|
|
247
280
|
const keys = await fetchApiKeys(token);
|
|
248
281
|
console.log("[LBProvider] Fetched keys:", keys.length);
|
|
@@ -266,23 +299,34 @@ export function LBProvider({
|
|
|
266
299
|
}
|
|
267
300
|
|
|
268
301
|
// Sinon, laisser l'utilisateur choisir
|
|
269
|
-
console.log(
|
|
302
|
+
console.log(
|
|
303
|
+
"[LBProvider] Multiple keys available, user needs to select"
|
|
304
|
+
);
|
|
270
305
|
setState({
|
|
271
306
|
status: "needs_key_selection",
|
|
272
307
|
user: result.user,
|
|
273
308
|
});
|
|
274
309
|
return { success: true, needsKeySelection: true };
|
|
275
|
-
|
|
276
310
|
} catch (keyError) {
|
|
311
|
+
console.error("[LBProvider] Failed to fetch API keys:");
|
|
312
|
+
console.error("[LBProvider] Error details:", keyError);
|
|
277
313
|
console.error(
|
|
278
|
-
"[LBProvider]
|
|
279
|
-
keyError
|
|
314
|
+
"[LBProvider] Error message:",
|
|
315
|
+
keyError instanceof Error ? keyError.message : String(keyError)
|
|
280
316
|
);
|
|
317
|
+
console.error(
|
|
318
|
+
"[LBProvider] Error stack:",
|
|
319
|
+
keyError instanceof Error ? keyError.stack : "No stack"
|
|
320
|
+
);
|
|
321
|
+
|
|
281
322
|
setState({
|
|
282
323
|
status: "needs_auth",
|
|
283
324
|
error: "Impossible de récupérer les clés API",
|
|
284
325
|
});
|
|
285
|
-
return {
|
|
326
|
+
return {
|
|
327
|
+
success: false,
|
|
328
|
+
error: "Impossible de récupérer les clés API",
|
|
329
|
+
};
|
|
286
330
|
}
|
|
287
331
|
} catch (error) {
|
|
288
332
|
const message =
|
package/src/hooks/usePrompts.ts
CHANGED
|
@@ -113,7 +113,7 @@ export function usePrompts(): UsePromptsReturn {
|
|
|
113
113
|
let endpoint: string;
|
|
114
114
|
if (options?.public) {
|
|
115
115
|
endpoint = isExternalProxy
|
|
116
|
-
? `${baseUrl}/
|
|
116
|
+
? `${baseUrl}/public/prompts?${params}`
|
|
117
117
|
: isPublicApi
|
|
118
118
|
? `${baseUrl}/prompts?${params}`
|
|
119
119
|
: baseUrl
|
|
@@ -121,7 +121,7 @@ export function usePrompts(): UsePromptsReturn {
|
|
|
121
121
|
: `/api/ai/public/prompts?${params}`;
|
|
122
122
|
} else {
|
|
123
123
|
endpoint = isExternalProxy
|
|
124
|
-
? `${baseUrl}/
|
|
124
|
+
? `${baseUrl}/auth/prompts?${params}`
|
|
125
125
|
: isPublicApi
|
|
126
126
|
? `${baseUrl}/prompts?${params}`
|
|
127
127
|
: baseUrl
|
|
@@ -175,7 +175,7 @@ export function usePrompts(): UsePromptsReturn {
|
|
|
175
175
|
|
|
176
176
|
const isExternalProxy = baseUrl && baseUrl.includes("/api/lastbrain");
|
|
177
177
|
const endpoint = isExternalProxy
|
|
178
|
-
? `${baseUrl}/prompts` // Proxy
|
|
178
|
+
? `${baseUrl}/auth/prompts` // Proxy ajoutera /api/ai/
|
|
179
179
|
: "/api/ai/auth/prompts";
|
|
180
180
|
|
|
181
181
|
const headers: HeadersInit = { "Content-Type": "application/json" };
|
|
@@ -217,7 +217,7 @@ export function usePrompts(): UsePromptsReturn {
|
|
|
217
217
|
const isPublicApi = baseUrl && baseUrl.includes("/api/public/v1");
|
|
218
218
|
|
|
219
219
|
const endpoint = isExternalProxy
|
|
220
|
-
? `${baseUrl}/
|
|
220
|
+
? `${baseUrl}/auth/prompts`
|
|
221
221
|
: isPublicApi
|
|
222
222
|
? `${baseUrl}/prompts`
|
|
223
223
|
: baseUrl
|
|
@@ -263,7 +263,7 @@ export function usePrompts(): UsePromptsReturn {
|
|
|
263
263
|
const isPublicApi = baseUrl && baseUrl.includes("/api/public/v1");
|
|
264
264
|
|
|
265
265
|
const endpoint = isExternalProxy
|
|
266
|
-
? `${baseUrl}/prompts?id=${id}` // Proxy
|
|
266
|
+
? `${baseUrl}/auth/prompts?id=${id}` // Proxy ajoutera /api/ai/
|
|
267
267
|
: isPublicApi
|
|
268
268
|
? `${baseUrl}/prompts?id=${id}`
|
|
269
269
|
: baseUrl
|
|
@@ -306,7 +306,7 @@ export function usePrompts(): UsePromptsReturn {
|
|
|
306
306
|
const isPublicApi = baseUrl && baseUrl.includes("/api/public/v1");
|
|
307
307
|
|
|
308
308
|
const endpoint = isExternalProxy
|
|
309
|
-
? `${baseUrl}/prompts/stats` // Proxy
|
|
309
|
+
? `${baseUrl}/auth/prompts/stats` // Proxy ajoutera /api/ai/
|
|
310
310
|
: isPublicApi
|
|
311
311
|
? `${baseUrl}/prompts/stats`
|
|
312
312
|
: baseUrl
|
|
@@ -33,7 +33,7 @@ export async function toggleUserModel(
|
|
|
33
33
|
const endpoint = isPublicApi
|
|
34
34
|
? `${baseUrl}/ai/user/models/toggle`
|
|
35
35
|
: isExternalProxy
|
|
36
|
-
? `${baseUrl}/ai
|
|
36
|
+
? `${baseUrl}/auth/ai-models-toggle` // Proxy ajoutera /api/ai/
|
|
37
37
|
: baseUrl
|
|
38
38
|
? `${baseUrl}/auth/ai-models-toggle`
|
|
39
39
|
: `/api/ai/auth/ai-models-toggle`;
|
|
@@ -129,7 +129,7 @@ export async function getUserModels(
|
|
|
129
129
|
const isPublicApi = baseUrl && baseUrl.includes("/api/public/v1");
|
|
130
130
|
|
|
131
131
|
const endpoint = isExternalProxy
|
|
132
|
-
? `${baseUrl}/
|
|
132
|
+
? `${baseUrl}/auth/user-models` // Proxy ajoutera /api/ai/
|
|
133
133
|
: isPublicApi
|
|
134
134
|
? `${baseUrl}/ai/user/models` // → /api/public/v1/ai/user/models
|
|
135
135
|
: baseUrl
|