Skip to content

Commit 2358e96

Browse files
committed
cleanup
1 parent ab40fd8 commit 2358e96

6 files changed

Lines changed: 14 additions & 177 deletions

File tree

app/(main)/chats/[id]/chat-box.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default function ChatBox({
6060
},
6161
).then((res) => {
6262
if (!res.body) {
63-
throw "foo";
63+
throw new Error("No body on response");
6464
}
6565
return res.body;
6666
});

app/(main)/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ export default function Home() {
104104
screenshotUrl,
105105
);
106106

107-
let streamPromise = fetch(
107+
const streamPromise = fetch(
108108
"/api/get-next-completion-stream-promise",
109109
{
110110
method: "POST",
111111
body: JSON.stringify({ messageId: lastMessageId, model }),
112112
},
113113
).then((res) => {
114114
if (!res.body) {
115-
throw "foo";
115+
throw new Error("No body on response");
116116
}
117117
return res.body;
118118
});

lib/prisma.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ declare global {
88

99
const neon = new Pool({ connectionString: process.env.DATABASE_URL });
1010
const adapter = new PrismaNeon(neon);
11-
const client = new PrismaClient({ adapter });
1211

13-
export default client;
12+
let client;
1413

15-
// const client = globalThis.prisma || new PrismaClient({ adapter });
16-
// if (process.env.NODE_ENV !== "production") globalThis.prisma = client;
17-
// console.log({ client });
14+
if (process.env.NODE_ENV !== "production") {
15+
client = globalThis.prisma || new PrismaClient({ adapter });
16+
globalThis.prisma = client;
17+
} else {
18+
client = new PrismaClient({ adapter });
19+
}
1820

19-
// export default client;
21+
export default client;

next.config.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { NextConfig } from "next";
2-
import bundleAnalyzer from "@next/bundle-analyzer";
32

43
const nextConfig: NextConfig = {
54
serverExternalPackages: ["@codesandbox/sdk"],
@@ -16,8 +15,4 @@ const nextConfig: NextConfig = {
1615
},
1716
};
1817

19-
const withBundleAnalyzer = bundleAnalyzer({
20-
enabled: process.env.ANALYZE === "true",
21-
});
22-
23-
export default withBundleAnalyzer(nextConfig);
18+
export default nextConfig;

package-lock.json

Lines changed: 2 additions & 161 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"@headlessui/react": "^2.2.0",
1818
"@heroicons/react": "^2.2.0",
1919
"@neondatabase/serverless": "^0.10.4",
20-
"@next/bundle-analyzer": "^15.1.4",
2120
"@prisma/adapter-neon": "^5",
2221
"@prisma/client": "^5",
2322
"@radix-ui/react-radio-group": "^1.2.2",

0 commit comments

Comments
 (0)