Spaces:
Paused
Paused
matt HOFFNER
commited on
Commit
Β·
cbb675f
1
Parent(s):
eed54e3
move into function
Browse files
src/app/api/chat/route.ts
CHANGED
@@ -1,13 +1,12 @@
|
|
1 |
import OpenAI from 'openai';
|
2 |
import { OpenAIStream, StreamingTextResponse } from 'ai';
|
3 |
|
4 |
-
const openai = new OpenAI({
|
5 |
-
apiKey: process.env.OPENAI_API_KEY,
|
6 |
-
});
|
7 |
-
|
8 |
export const runtime = 'edge';
|
9 |
|
10 |
export async function POST(req: Request) {
|
|
|
|
|
|
|
11 |
const { messages, data } = await req.json();
|
12 |
const vectorStoreResultsString = data.vectorStoreResults;
|
13 |
|
|
|
1 |
import OpenAI from 'openai';
|
2 |
import { OpenAIStream, StreamingTextResponse } from 'ai';
|
3 |
|
|
|
|
|
|
|
|
|
4 |
export const runtime = 'edge';
|
5 |
|
6 |
export async function POST(req: Request) {
|
7 |
+
const openai = new OpenAI({
|
8 |
+
apiKey: process.env.OPENAI_API_KEY,
|
9 |
+
});
|
10 |
const { messages, data } = await req.json();
|
11 |
const vectorStoreResultsString = data.vectorStoreResults;
|
12 |
|