Skip to content

Commit 5842abf

Browse files
committed
Fix fetchAPI calling issues for agents
1 parent 159adc3 commit 5842abf

File tree

11 files changed

+84
-17
lines changed

11 files changed

+84
-17
lines changed

mobile/capacitor.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const config: CapacitorConfig = {
1818
enabled: true,
1919
},
2020
CapacitorHttp: {
21-
enabled: true,
21+
enabled: false,
2222
},
2323
},
2424
};

npm-packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pulse-editor/cli",
3-
"version": "0.1.0-beta.8",
3+
"version": "0.1.1-beta.0",
44
"license": "MIT",
55
"bin": {
66
"pulse": "dist/cli.js"

web/components/interface/command-viewer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ export default function CommandViewer() {
295295

296296
return (
297297
<div className="absolute top-20 left-1/2 z-50 -translate-x-1/2">
298-
<div className="flex max-h-[calc(100vh-100px)] flex-col items-center gap-y-1">
298+
<div className="flex max-h-[calc(100vh-140px)] flex-col items-center gap-y-1">
299299
<Input
300300
className="w-80"
301301
classNames={{
@@ -356,7 +356,7 @@ export default function CommandViewer() {
356356
/>
357357

358358
{history.length > 0 && (
359-
<div className="bg-content1 flex w-[480px] flex-col overflow-y-hidden rounded-2xl px-2 pt-2 shadow-md">
359+
<div className="bg-content1 flex w-full sm:w-[480px] flex-col overflow-y-hidden rounded-2xl px-2 pt-2 shadow-md">
360360
<div
361361
className="flex flex-col gap-y-2 overflow-y-auto pb-2"
362362
ref={historyRef}

web/components/modals/publish-workflow-modal.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ export default function PublishWorkflowModal({
5858
await fetchAPI("/api/workflow/publish", {
5959
method: "POST",
6060
body: JSON.stringify({ ...workflow }),
61+
headers: {
62+
"Content-Type": "application/json",
63+
},
6164
});
6265

6366
addToast({

web/components/modals/sharing-modal.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ export default function SharingModal({
7373
visibility,
7474
name: app,
7575
}),
76+
headers: {
77+
"Content-Type": "application/json",
78+
},
7679
});
7780

7881
mutate();

web/lib/agent/agent-runner.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ export async function runAgentMethodCloud(
3838
{
3939
method: "POST",
4040
body: JSON.stringify({ prompt }),
41+
headers: {
42+
"Content-Type": "application/json",
43+
},
4144
},
4245
);
4346

web/lib/hooks/use-auth.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ export function useAuth() {
7777
possibly after other hooks are fired.
7878
*/
7979
if (!token.value) {
80-
// CapacitorCookies.clearAllCookies();
81-
CapacitorCookies.deleteCookie({
80+
await CapacitorCookies.deleteCookie({
8281
key: "pulse-editor.session-token",
8382
url: process.env.NEXT_PUBLIC_BACKEND_URL,
8483
});
@@ -95,6 +94,17 @@ export function useAuth() {
9594
refreshSession();
9695
}, [editorContext?.editorStates.isRefreshSession]);
9796

97+
// Set is login status in Preferences in Capacitor if logged in
98+
useEffect(() => {
99+
if (getPlatform() === PlatformEnum.Capacitor) {
100+
const isLoggedIn = session !== undefined;
101+
Preferences.set({
102+
key: "pulse-editor.is-logged-in",
103+
value: isLoggedIn ? "true" : "false",
104+
});
105+
}
106+
}, [session]);
107+
98108
// Open a sign-in page if the user is not signed in.
99109
async function signIn() {
100110
if (session) {

web/lib/modalities/image-gen/image-gen.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ export function getImageGenModel(
131131
body: JSON.stringify({
132132
token: apiKey,
133133
}),
134+
headers: {
135+
"Content-Type": "application/json",
136+
},
134137
},
135138
);
136139
console.log("Fetching prediction status:", prediction.id);

web/lib/modalities/music-gen/music-gen.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ export function getMusicGenModel(
130130
body: JSON.stringify({
131131
token: apiKey,
132132
}),
133+
headers: {
134+
"Content-Type": "application/json",
135+
},
133136
},
134137
);
135138
console.log("Fetching prediction status:", prediction.id);

web/lib/modalities/video-gen/video-gen.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ export function getVideoGenModel(
160160
body: JSON.stringify({
161161
token: apiKey,
162162
}),
163+
headers: {
164+
"Content-Type": "application/json",
165+
},
163166
},
164167
);
165168
console.log("Fetching prediction status:", prediction.id);

0 commit comments

Comments
 (0)