@howone/sdk 0.3.12 → 0.3.15
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.d.mts +16 -7
- package/dist/index.d.ts +16 -7
- package/dist/index.js +81 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1280,6 +1280,23 @@ var injectRedirectOverlayStyles = () => {
|
|
|
1280
1280
|
transform: scale(1.05);
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
1283
|
+
|
|
1284
|
+
[data-howone-auth-overlay-root] {
|
|
1285
|
+
position: fixed;
|
|
1286
|
+
inset: 0;
|
|
1287
|
+
z-index: 2147483646;
|
|
1288
|
+
display: flex;
|
|
1289
|
+
flex-direction: column;
|
|
1290
|
+
align-items: center;
|
|
1291
|
+
justify-content: center;
|
|
1292
|
+
width: 100vw;
|
|
1293
|
+
height: 100vh;
|
|
1294
|
+
color: #ffffff;
|
|
1295
|
+
background: rgba(0, 0, 0, 0.65);
|
|
1296
|
+
backdrop-filter: blur(6px);
|
|
1297
|
+
-webkit-backdrop-filter: blur(6px);
|
|
1298
|
+
text-align: center;
|
|
1299
|
+
}
|
|
1283
1300
|
`;
|
|
1284
1301
|
document.head.appendChild(style);
|
|
1285
1302
|
redirectOverlayStylesInjected = true;
|
|
@@ -1346,14 +1363,32 @@ var HowOneProvider = ({
|
|
|
1346
1363
|
}, [pendingRedirect]);
|
|
1347
1364
|
const redirectToAuth = useCallback4(() => {
|
|
1348
1365
|
if (!redirectOnUnauthenticated || typeof window === "undefined") return;
|
|
1366
|
+
const activeProjectId = projectId ?? getDefaultProjectId();
|
|
1367
|
+
const navigateToResolvedAuth = () => {
|
|
1368
|
+
setPendingRedirect(true);
|
|
1369
|
+
requestAnimationFrame(() => {
|
|
1370
|
+
if (activeProjectId) {
|
|
1371
|
+
try {
|
|
1372
|
+
const url = new URL(resolvedAuthUrl);
|
|
1373
|
+
url.searchParams.set("redirect_uri", window.location.href);
|
|
1374
|
+
url.searchParams.set("project_id", activeProjectId);
|
|
1375
|
+
window.location.href = url.toString();
|
|
1376
|
+
return;
|
|
1377
|
+
} catch (error) {
|
|
1378
|
+
console.error("[HowOneProvider] Failed to attach project_id to auth URL:", error);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
window.location.href = resolvedAuthUrl;
|
|
1382
|
+
});
|
|
1383
|
+
};
|
|
1349
1384
|
try {
|
|
1350
1385
|
const currentUrl = new URL(window.location.href);
|
|
1351
1386
|
if (currentUrl.pathname.includes("/auth")) return;
|
|
1352
1387
|
try {
|
|
1353
1388
|
const authUrlObj = new URL(resolvedAuthUrl);
|
|
1354
1389
|
authUrlObj.searchParams.set("redirect_uri", window.location.href);
|
|
1355
|
-
if (
|
|
1356
|
-
authUrlObj.searchParams.set("project_id",
|
|
1390
|
+
if (activeProjectId) {
|
|
1391
|
+
authUrlObj.searchParams.set("project_id", activeProjectId);
|
|
1357
1392
|
}
|
|
1358
1393
|
setPendingRedirect(true);
|
|
1359
1394
|
requestAnimationFrame(() => {
|
|
@@ -1363,15 +1398,9 @@ var HowOneProvider = ({
|
|
|
1363
1398
|
} catch (error) {
|
|
1364
1399
|
console.error("[HowOneProvider] Failed to build auth URL:", error);
|
|
1365
1400
|
}
|
|
1366
|
-
|
|
1367
|
-
requestAnimationFrame(() => {
|
|
1368
|
-
window.location.href = resolvedAuthUrl;
|
|
1369
|
-
});
|
|
1401
|
+
navigateToResolvedAuth();
|
|
1370
1402
|
} catch {
|
|
1371
|
-
|
|
1372
|
-
requestAnimationFrame(() => {
|
|
1373
|
-
window.location.href = resolvedAuthUrl;
|
|
1374
|
-
});
|
|
1403
|
+
navigateToResolvedAuth();
|
|
1375
1404
|
}
|
|
1376
1405
|
}, [redirectOnUnauthenticated, resolvedAuthUrl, projectId]);
|
|
1377
1406
|
useEffect6(() => {
|
|
@@ -1406,24 +1435,31 @@ var HowOneProvider = ({
|
|
|
1406
1435
|
/* @__PURE__ */ jsx7(ElementSelectorProvider, { children: /* @__PURE__ */ jsxs5(HowoneContext.Provider, { value, children: [
|
|
1407
1436
|
children,
|
|
1408
1437
|
showFloatingButton && /* @__PURE__ */ jsx7(FloatingButton, { onClick: () => window.open("https://howone.ai", "_blank") }),
|
|
1409
|
-
pendingRedirect && /* @__PURE__ */ jsx7(
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1438
|
+
pendingRedirect && /* @__PURE__ */ jsx7(
|
|
1439
|
+
"div",
|
|
1440
|
+
{
|
|
1441
|
+
"data-howone-auth-overlay-root": true,
|
|
1442
|
+
className: "fixed inset-0 z-[100000] h-full w-full flex flex-col items-center justify-center bg-black/65 backdrop-blur-sm text-white",
|
|
1443
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "relative mt-6 flex h-[220px] w-[220px] items-center justify-center", children: [
|
|
1444
|
+
/* @__PURE__ */ jsx7(
|
|
1445
|
+
"div",
|
|
1446
|
+
{
|
|
1447
|
+
className: "absolute inset-0 rounded-full bg-white/20",
|
|
1448
|
+
style: { animation: "howone-glow-ring 2.4s ease-in-out infinite" }
|
|
1449
|
+
}
|
|
1450
|
+
),
|
|
1451
|
+
/* @__PURE__ */ jsx7("div", { className: "absolute inset-0 rounded-full bg-gradient-to-br from-white/10 via-white/25 to-white/10 blur-2xl" }),
|
|
1452
|
+
/* @__PURE__ */ jsx7(
|
|
1453
|
+
"img",
|
|
1454
|
+
{
|
|
1455
|
+
style: { width: 250, animation: "howone-logo-pulse 2s ease-in-out infinite" },
|
|
1456
|
+
src: "https://sxwxqoixnnklnpeutjrj.supabase.co/storage/v1/object/public/create-x/logo/logo.svg",
|
|
1457
|
+
alt: "HowOne"
|
|
1458
|
+
}
|
|
1459
|
+
)
|
|
1460
|
+
] })
|
|
1461
|
+
}
|
|
1462
|
+
)
|
|
1427
1463
|
] }) }),
|
|
1428
1464
|
/* @__PURE__ */ jsx7(GlobalToastContainer, {})
|
|
1429
1465
|
]
|
|
@@ -2567,9 +2603,7 @@ function createAIClient(req, projectId) {
|
|
|
2567
2603
|
signal
|
|
2568
2604
|
});
|
|
2569
2605
|
return {
|
|
2570
|
-
imageUrl: response.imageUrl
|
|
2571
|
-
taskId: response.taskId || response.id,
|
|
2572
|
-
metadata: response.metadata
|
|
2606
|
+
imageUrl: response.data.result.imageUrl
|
|
2573
2607
|
};
|
|
2574
2608
|
}
|
|
2575
2609
|
};
|
|
@@ -3571,16 +3605,25 @@ function createClient(opts) {
|
|
|
3571
3605
|
* @example
|
|
3572
3606
|
* ```typescript
|
|
3573
3607
|
* const result = await client.sse.request.post({
|
|
3574
|
-
* workflowId: '
|
|
3575
|
-
* inputs: {
|
|
3576
|
-
*
|
|
3577
|
-
*
|
|
3578
|
-
*
|
|
3608
|
+
* workflowId: 'd27e7fbd-651a-4ff1-ae44-a220cb3b0522',
|
|
3609
|
+
* inputs: {
|
|
3610
|
+
* source_file_url: fileUrl,
|
|
3611
|
+
* analysis_depth: 'standard',
|
|
3612
|
+
* },
|
|
3613
|
+
* onNodeStart: (name) => console.log(`执行节点: ${name}`),
|
|
3614
|
+
* onStreamContent: (delta) => console.log(`内容片段: ${delta}`),
|
|
3615
|
+
* onCostUpdate: (stats) => console.log(`累计 Token: ${stats.totalToken}`)
|
|
3579
3616
|
* })
|
|
3580
3617
|
*
|
|
3581
3618
|
* // 也可以获取流式控制:
|
|
3582
|
-
* const session = client.sse.stream.post({
|
|
3583
|
-
*
|
|
3619
|
+
* const session = client.sse.stream.post({
|
|
3620
|
+
* workflowId: 'd27e7fbd-651a-4ff1-ae44-a220cb3b0522',
|
|
3621
|
+
* inputs: { source_file_url: fileUrl, analysis_depth: 'standard' },
|
|
3622
|
+
* })
|
|
3623
|
+
* const events = client.sse.events.post({
|
|
3624
|
+
* workflowId: 'd27e7fbd-651a-4ff1-ae44-a220cb3b0522',
|
|
3625
|
+
* inputs: { source_file_url: fileUrl, analysis_depth: 'standard' },
|
|
3626
|
+
* })
|
|
3584
3627
|
* ```
|
|
3585
3628
|
*/
|
|
3586
3629
|
sseRequest: sseRequestWrapped,
|