matt HOFFNER commited on
Commit
c23d919
·
1 Parent(s): ad989b7

render response

Browse files
src/app/search/web/page.jsx CHANGED
@@ -1,10 +1,7 @@
1
  "use client"
2
  import { useEffect, useState } from "react";
3
- import WebSearchResults from "@/components/WebSearchResults";
4
- import Link from "next/link";
5
 
6
  export default function WebSearchPage({ searchParams }) {
7
- const [results, setResults] = useState(null);
8
  const [aiResponse, setAiResponse] = useState(null);
9
  const startIndex = searchParams.start || "1";
10
 
@@ -26,18 +23,6 @@ export default function WebSearchPage({ searchParams }) {
26
  };
27
  }, [searchParams, startIndex]);
28
 
29
- if (!results) {
30
- return (
31
- <div className="flex flex-col justify-center items-center pt-10">
32
- <h1 className="text-3xl mb-4">No results found</h1>
33
- <p className="text-lg">
34
- Try searching for something else or go back to the homepage{" "}
35
- <Link href="/" className="text-blue-500">
36
- Home
37
- </Link>
38
- </p>
39
- </div>
40
- );
41
- }
42
- return <>{results && <WebSearchResults results={results} aiResponse={aiResponse} />}</>;
43
  }
 
1
  "use client"
2
  import { useEffect, useState } from "react";
 
 
3
 
4
  export default function WebSearchPage({ searchParams }) {
 
5
  const [aiResponse, setAiResponse] = useState(null);
6
  const startIndex = searchParams.start || "1";
7
 
 
23
  };
24
  }, [searchParams, startIndex]);
25
 
26
+
27
+ return <>{aiResponse ? JSON.stringify(aiResponse) : 'Loading...'}</>;
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
src/pages/api/llm.js CHANGED
@@ -55,6 +55,7 @@ export default function handler(req, res) {
55
 
56
  while (true) {
57
  response = await getCompletion(messages);
 
58
 
59
  if (response.data.choices[0].finish_reason === "stop") {
60
  res.write(`data: ${JSON.stringify({ result: response.data.choices[0].message.content })}\n\n`);
 
55
 
56
  while (true) {
57
  response = await getCompletion(messages);
58
+ console.log(response);
59
 
60
  if (response.data.choices[0].finish_reason === "stop") {
61
  res.write(`data: ${JSON.stringify({ result: response.data.choices[0].message.content })}\n\n`);