From 6935cb0eea3fd99d1a6e47dc6997fed61df445ed Mon Sep 17 00:00:00 2001 From: eth9n-dev Date: Wed, 24 Apr 2024 17:23:48 -0700 Subject: [PATCH 1/6] GPTSearch: basic page setup --- package.json | 1 + src/app/models/_components/gpt-search.tsx | 75 +++++++++++++++++++ .../models/editor/[modelId]/search/page.tsx | 16 ++++ 3 files changed, 92 insertions(+) create mode 100644 src/app/models/_components/gpt-search.tsx create mode 100644 src/app/models/editor/[modelId]/search/page.tsx diff --git a/package.json b/package.json index 50360a1..bfc0ec6 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "start": "next start" }, "dependencies": { + "@adobe/react-spectrum": "^3.34.1", "@auth/prisma-adapter": "^1.6.0", "@hookform/resolvers": "^3.3.4", "@prisma/client": "^5.12.1", diff --git a/src/app/models/_components/gpt-search.tsx b/src/app/models/_components/gpt-search.tsx new file mode 100644 index 0000000..6afe2d5 --- /dev/null +++ b/src/app/models/_components/gpt-search.tsx @@ -0,0 +1,75 @@ +"use client"; +import React, { useState } from "react"; + +interface SearchResult { + // Define your search result interface here based on your API response + // For demonstration purposes, let's assume it's just a string + result: string; +} + +const GptSearchPage: React.FC = ({ keys }) => { + const [query, setQuery] = useState(""); + const [searchResult, setSearchResult] = useState(null); + const options = { + method: "POST", + headers: { + accept: "text/plain", + "x-api-key": keys[0], + "x-openai-key": keys[1], + "x-user-id": "UniqueUserIdentifier", + "content-type": "application/json", + }, + body: JSON.stringify({ + size: 25, + query: query, + }), + }; + + const handleSubmit = async () => { + fetch("https://api.realestateapi.com/v2/PropGPT", options) + .then((response) => response.json()) + .then((response) => console.log(response)) + .catch((err) => console.error(err)); + }; + + return ( +
+
+
+ + setQuery(e.target.value)} + required + /> +
+ +
+ {searchResult && ( +
+

Search Result:

+

{searchResult.result}

+
+ )} +
+ ); +}; + +export default GptSearchPage; diff --git a/src/app/models/editor/[modelId]/search/page.tsx b/src/app/models/editor/[modelId]/search/page.tsx new file mode 100644 index 0000000..9d23eaf --- /dev/null +++ b/src/app/models/editor/[modelId]/search/page.tsx @@ -0,0 +1,16 @@ +import React from "react"; +import GptSearchPage from "~/app/models/_components/gpt-search"; +import { env } from "~/env"; + +const keys: string[] = [process.env.TEAM_API_KEY!, process.env.OPENAI_API_KEY!]; + +function page() { + console.log(keys); + return ( +
+ +
+ ); +} + +export default page; From fd33432c64cfe5846d06f234d8e2b2715c8b8d86 Mon Sep 17 00:00:00 2001 From: eth9n-dev Date: Thu, 25 Apr 2024 18:45:35 -0700 Subject: [PATCH 2/6] GPTSearch: PropertyCard component --- package.json | 3 ++ src/app/api/trpc/[trpc]/route.ts | 16 +++++++--- src/app/models/_components/gpt-search.tsx | 14 ++++----- src/app/models/_components/property-card.tsx | 30 +++++++++++++++++++ .../models/editor/[modelId]/search/page.tsx | 2 ++ 5 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 src/app/models/_components/property-card.tsx diff --git a/package.json b/package.json index bfc0ec6..e899904 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "plot-ai", "version": "0.1.0", "private": true, + "proxy": "http://localhost:3000", "type": "module", "scripts": { "build": "next build", @@ -39,6 +40,7 @@ "next": "^14.2.2", "next-auth": "^4.24.7", "next-themes": "^0.3.0", + "nextjs-cors": "^2.2.0", "radix-ui": "^1.0.1", "react": "18.2.0", "react-dom": "18.2.0", @@ -47,6 +49,7 @@ "server-only": "^0.0.1", "sonner": "^1.4.41", "superjson": "^2.2.1", + "swr": "^2.2.5", "tailwind-merge": "^2.3.0", "tailwindcss-animate": "^1.0.7", "zod": "^3.23.0" diff --git a/src/app/api/trpc/[trpc]/route.ts b/src/app/api/trpc/[trpc]/route.ts index 5fbd827..983ad3a 100644 --- a/src/app/api/trpc/[trpc]/route.ts +++ b/src/app/api/trpc/[trpc]/route.ts @@ -1,10 +1,12 @@ import { fetchRequestHandler } from "@trpc/server/adapters/fetch"; -import { type NextRequest } from "next/server"; +import { NextResponse, type NextRequest } from "next/server"; import { env } from "~/env"; import { appRouter } from "~/server/api/root"; import { createTRPCContext } from "~/server/api/trpc"; +import { NextApiResponse } from "next"; + /** * This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when * handling a HTTP request (e.g. when you make requests from Client Components). @@ -15,8 +17,13 @@ const createContext = async (req: NextRequest) => { }); }; -const handler = (req: NextRequest) => - fetchRequestHandler({ +const handler = async (req: NextRequest, res: NextApiResponse) => { + res.setHeader("Access-Control-Allow-Origin", "*"); + res.setHeader("Access-Control-Request-Method", "*"); + res.setHeader("Access-Control-Allow-Methods", "OPTIONS, GET"); + res.setHeader("Access-Control-Allow-Headers", "*"); + + return fetchRequestHandler({ endpoint: "/api/trpc", req, router: appRouter, @@ -25,10 +32,11 @@ const handler = (req: NextRequest) => env.NODE_ENV === "development" ? ({ path, error }) => { console.error( - `❌ tRPC failed on ${path ?? ""}: ${error.message}` + `❌ tRPC failed on ${path ?? ""}: ${error.message}`, ); } : undefined, }); +}; export { handler as GET, handler as POST }; diff --git a/src/app/models/_components/gpt-search.tsx b/src/app/models/_components/gpt-search.tsx index 6afe2d5..d64e89a 100644 --- a/src/app/models/_components/gpt-search.tsx +++ b/src/app/models/_components/gpt-search.tsx @@ -1,5 +1,6 @@ "use client"; import React, { useState } from "react"; +import { Button } from "~/components/ui/button"; interface SearchResult { // Define your search result interface here based on your API response @@ -12,6 +13,7 @@ const GptSearchPage: React.FC = ({ keys }) => { const [searchResult, setSearchResult] = useState(null); const options = { method: "POST", + mode: "no-cors", headers: { accept: "text/plain", "x-api-key": keys[0], @@ -33,7 +35,8 @@ const GptSearchPage: React.FC = ({ keys }) => { }; return ( -
+
+

Use AI to find properties:

{ required />
- + {searchResult && (
diff --git a/src/app/models/_components/property-card.tsx b/src/app/models/_components/property-card.tsx new file mode 100644 index 0000000..ecb03d5 --- /dev/null +++ b/src/app/models/_components/property-card.tsx @@ -0,0 +1,30 @@ +import React from "react"; + +const PropertyCard = ({ imageUrl, price, address, params }) => { + return ( +
+
+
+
+ {address} +
+
+
+

${price}

+

{address}

+
+ {params?.map((param) => ( +

Param

+ ))} +
+
+
+
+ ); +}; + +export default PropertyCard; diff --git a/src/app/models/editor/[modelId]/search/page.tsx b/src/app/models/editor/[modelId]/search/page.tsx index 9d23eaf..dcd49d3 100644 --- a/src/app/models/editor/[modelId]/search/page.tsx +++ b/src/app/models/editor/[modelId]/search/page.tsx @@ -1,5 +1,6 @@ import React from "react"; import GptSearchPage from "~/app/models/_components/gpt-search"; +import PropertyCard from "~/app/models/_components/property-card"; import { env } from "~/env"; const keys: string[] = [process.env.TEAM_API_KEY!, process.env.OPENAI_API_KEY!]; @@ -8,6 +9,7 @@ function page() { console.log(keys); return (
+
); From 3a338efb80f1d105cde83c802c46916c545caaeb Mon Sep 17 00:00:00 2001 From: eth9n-dev Date: Thu, 25 Apr 2024 18:48:28 -0700 Subject: [PATCH 3/6] GPTSearch: bugfix --- src/app/models/_components/property-card.tsx | 4 ++-- src/app/models/editor/[modelId]/search/page.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/models/_components/property-card.tsx b/src/app/models/_components/property-card.tsx index ecb03d5..bbc6185 100644 --- a/src/app/models/_components/property-card.tsx +++ b/src/app/models/_components/property-card.tsx @@ -1,6 +1,6 @@ import React from "react"; -const PropertyCard = ({ imageUrl, price, address, params }) => { +const PropertyCard = ({ imageUrl, price, address, propDetails }) => { return (
@@ -17,7 +17,7 @@ const PropertyCard = ({ imageUrl, price, address, params }) => {

${price}

{address}

- {params?.map((param) => ( + {propDetails?.map((param) => (

Param

))}
diff --git a/src/app/models/editor/[modelId]/search/page.tsx b/src/app/models/editor/[modelId]/search/page.tsx index dcd49d3..a99ea16 100644 --- a/src/app/models/editor/[modelId]/search/page.tsx +++ b/src/app/models/editor/[modelId]/search/page.tsx @@ -9,7 +9,7 @@ function page() { console.log(keys); return (
- +
); From e6391d479ee9b6d7541d6e4f31936eec4db7b6cb Mon Sep 17 00:00:00 2001 From: eth9n-dev Date: Fri, 26 Apr 2024 18:06:31 -0700 Subject: [PATCH 4/6] GPTSearch: Find parameter matches logic --- src/app/models/_components/gpt-search.tsx | 39 ++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/src/app/models/_components/gpt-search.tsx b/src/app/models/_components/gpt-search.tsx index d64e89a..47eddfd 100644 --- a/src/app/models/_components/gpt-search.tsx +++ b/src/app/models/_components/gpt-search.tsx @@ -11,6 +11,7 @@ interface SearchResult { const GptSearchPage: React.FC = ({ keys }) => { const [query, setQuery] = useState(""); const [searchResult, setSearchResult] = useState(null); + const options = { method: "POST", mode: "no-cors", @@ -27,16 +28,46 @@ const GptSearchPage: React.FC = ({ keys }) => { }), }; + // Fetching Data Here const handleSubmit = async () => { fetch("https://api.realestateapi.com/v2/PropGPT", options) .then((response) => response.json()) - .then((response) => console.log(response)) + .then((response) => { + /* Do something with the response */ + findPropertyMatches(response, nodeData); + }) .catch((err) => console.error(err)); }; + // This function will find matching parameters in both json objects and populate the matches + // list with the key and the value (response: ApiResponse, nodeData: The model's node data returned by our database) + function findPropertyMatches(response, nodeData) { + // Extract key names and values from the first JSON object + const keyValues = response.data[0]; + + // Initialize an array to store matches with values + const matches = []; + + // Iterate over the 'data' array in the second JSON object + nodeData.nodes.forEach((node) => { + node.data.forEach((dataItem) => { + // Check if the 'value' key exists + if (dataItem.hasOwnProperty("value")) { + // Check if the value matches any key names from the first JSON object + const keyName = dataItem.value; + if (keyValues.hasOwnProperty(keyName)) { + matches.push({ key: keyName, value: keyValues[keyName] }); + } + } + }); + }); + } + return ( -
-

Use AI to find properties:

+
+

+ Use AI to find properties: +

{ required />
- From 12000b858e0041eef75842b18ff169d98116aab4 Mon Sep 17 00:00:00 2001 From: eth9n-dev Date: Fri, 26 Apr 2024 19:51:58 -0700 Subject: [PATCH 5/6] GPTSearch: backend route for matches --- src/app/api/trpc/[trpc]/route.ts | 5 - src/app/models/_components/gpt-search.tsx | 170 ++++++++++++------ .../models/editor/[modelId]/search/page.tsx | 6 +- src/server/api/root.ts | 5 +- src/server/api/routers/propertySearch.ts | 77 ++++++++ 5 files changed, 200 insertions(+), 63 deletions(-) create mode 100644 src/server/api/routers/propertySearch.ts diff --git a/src/app/api/trpc/[trpc]/route.ts b/src/app/api/trpc/[trpc]/route.ts index c466a94..e7bc5a8 100644 --- a/src/app/api/trpc/[trpc]/route.ts +++ b/src/app/api/trpc/[trpc]/route.ts @@ -19,11 +19,6 @@ const createContext = async (req: NextRequest) => { }; const handler = async (req: NextRequest, res: NextApiResponse) => { - res.setHeader("Access-Control-Allow-Origin", "*"); - res.setHeader("Access-Control-Request-Method", "*"); - res.setHeader("Access-Control-Allow-Methods", "OPTIONS, GET"); - res.setHeader("Access-Control-Allow-Headers", "*"); - return fetchRequestHandler({ endpoint: "/api/trpc", req, diff --git a/src/app/models/_components/gpt-search.tsx b/src/app/models/_components/gpt-search.tsx index 47eddfd..fe505eb 100644 --- a/src/app/models/_components/gpt-search.tsx +++ b/src/app/models/_components/gpt-search.tsx @@ -1,6 +1,8 @@ "use client"; import React, { useState } from "react"; +import { useModelNodesContext } from "~/app/_context/model-context"; import { Button } from "~/components/ui/button"; +import { api } from "~/trpc/react"; interface SearchResult { // Define your search result interface here based on your API response @@ -8,60 +10,128 @@ interface SearchResult { result: string; } -const GptSearchPage: React.FC = ({ keys }) => { +const GptSearchPage: React.FC = ({}) => { const [query, setQuery] = useState(""); const [searchResult, setSearchResult] = useState(null); - - const options = { - method: "POST", - mode: "no-cors", - headers: { - accept: "text/plain", - "x-api-key": keys[0], - "x-openai-key": keys[1], - "x-user-id": "UniqueUserIdentifier", - "content-type": "application/json", + const fetchProperties = api.propertySearch.search.useMutation(); + const nodes = { + nodes: [ + { + id: "0", + type: "blockComp", + data: [ + { + id: "vy4wuo965iq", + section: "Property Details", + value: "deckArea", + label: "Deck Area", + format: "size", + input: 0, + operator: "", + visible: true, + }, + { + id: "ej2pk6l6lsj", + section: "Property Details", + value: "deckArea", + label: "Deck Area", + format: "size", + input: 0, + operator: "", + visible: true, + }, + { + id: "1yx5rx7c9wfh", + section: "Property Details", + value: "squareFeet", + label: "Square Feet", + format: "size", + input: 0, + operator: "", + visible: true, + }, + { + id: "09ushjuob9px", + section: "Property Details", + value: "unitsCount", + label: "Unit Count", + format: "number", + input: 0, + operator: "", + visible: true, + }, + ], + dragHandle: ".custom-drag-handle", + style: { + border: "2px solid #ddd", + background: "white", + borderRadius: "8px", + }, + position: { x: 0, y: 0 }, + width: 276, + height: 196, + }, + { + id: "1", + type: "blockComp", + dragHandle: ".custom-drag-handle", + position: { x: 311.5153248642067, y: 108.71122718380283 }, + style: { + border: "2px solid #ddd", + background: "white", + borderRadius: "8px", + }, + data: [ + { + id: "3n36fktrp4y", + section: "Financial Valuation", + value: "assessedLandValue", + label: "Assessed Land Value", + format: "USD", + input: 0, + operator: "", + visible: true, + }, + { + id: "raeiz6vfwu", + section: "Financial Valuation", + value: "priorSaleAmount", + label: "Prior Sale Amount", + format: "USD", + input: 0, + operator: "", + visible: true, + }, + { + id: "qoa6conq1o", + section: "Financial Valuation", + value: "assessedValue", + label: "Assessed Value", + format: "USD", + input: 0, + operator: "", + visible: true, + }, + ], + width: 276, + height: 196, + }, + ], + edges: [{ id: "1", source: "0", target: "1" }], + viewport: { + x: -251.76669469951742, + y: -24.53523350178338, + zoom: 1.3571296849803665, }, - body: JSON.stringify({ - size: 25, - query: query, - }), - }; - - // Fetching Data Here - const handleSubmit = async () => { - fetch("https://api.realestateapi.com/v2/PropGPT", options) - .then((response) => response.json()) - .then((response) => { - /* Do something with the response */ - findPropertyMatches(response, nodeData); - }) - .catch((err) => console.error(err)); }; - // This function will find matching parameters in both json objects and populate the matches - // list with the key and the value (response: ApiResponse, nodeData: The model's node data returned by our database) - function findPropertyMatches(response, nodeData) { - // Extract key names and values from the first JSON object - const keyValues = response.data[0]; - - // Initialize an array to store matches with values - const matches = []; - - // Iterate over the 'data' array in the second JSON object - nodeData.nodes.forEach((node) => { - node.data.forEach((dataItem) => { - // Check if the 'value' key exists - if (dataItem.hasOwnProperty("value")) { - // Check if the value matches any key names from the first JSON object - const keyName = dataItem.value; - if (keyValues.hasOwnProperty(keyName)) { - matches.push({ key: keyName, value: keyValues[keyName] }); - } - } - }); + const handleSubmit: React.FormEventHandler = (e) => { + const result = fetchProperties.mutate({ + nodes: JSON.stringify(nodes), + userInput: query, }); - } + console.log(result); + }; return (
@@ -89,9 +159,7 @@ const GptSearchPage: React.FC = ({ keys }) => { required />
- + {searchResult && (
diff --git a/src/app/models/editor/[modelId]/search/page.tsx b/src/app/models/editor/[modelId]/search/page.tsx index a99ea16..6f1a162 100644 --- a/src/app/models/editor/[modelId]/search/page.tsx +++ b/src/app/models/editor/[modelId]/search/page.tsx @@ -1,16 +1,12 @@ import React from "react"; import GptSearchPage from "~/app/models/_components/gpt-search"; import PropertyCard from "~/app/models/_components/property-card"; -import { env } from "~/env"; - -const keys: string[] = [process.env.TEAM_API_KEY!, process.env.OPENAI_API_KEY!]; function page() { - console.log(keys); return (
- +
); } diff --git a/src/server/api/root.ts b/src/server/api/root.ts index 3e13bfb..23d16f3 100644 --- a/src/server/api/root.ts +++ b/src/server/api/root.ts @@ -1,6 +1,7 @@ import { postRouter } from "~/server/api/routers/post"; import { modelsRouter } from "~/server/api/routers/models"; import { createCallerFactory, createTRPCRouter } from "~/server/api/trpc"; +import { propertySearchRouter } from "./routers/propertySearch"; /** * This is the primary router for your server. @@ -9,7 +10,8 @@ import { createCallerFactory, createTRPCRouter } from "~/server/api/trpc"; */ export const appRouter = createTRPCRouter({ post: postRouter, - models: modelsRouter + models: modelsRouter, + propertySearch: propertySearchRouter, }); // export type definition of API @@ -23,4 +25,3 @@ export type AppRouter = typeof appRouter; * ^? Post[] */ export const createCaller = createCallerFactory(appRouter); - diff --git a/src/server/api/routers/propertySearch.ts b/src/server/api/routers/propertySearch.ts new file mode 100644 index 0000000..893647f --- /dev/null +++ b/src/server/api/routers/propertySearch.ts @@ -0,0 +1,77 @@ +import { z } from "zod"; +import { env } from "~/env"; + +const keys: string[] = [process.env.TEAM_API_KEY!, process.env.OPENAI_API_KEY!]; + +import { createTRPCRouter, protectedProcedure } from "~/server/api/trpc"; + +export const propertySearchRouter = createTRPCRouter({ + search: protectedProcedure + .input(z.object({ nodes: z.string(), userInput: z.string() })) + .mutation(async ({ input }) => { + const nodeData = JSON.parse(input.nodes); + console.log("DATA==========", nodeData); + const options: RequestInit = { + method: "POST", + headers: { + accept: "text/plain", + "x-api-key": keys[0], + "x-openai-key": keys[1], + "x-user-id": "UniqueUserIdentifier", + "content-type": "application/json", + }, + body: JSON.stringify({ + size: 25, + query: input.userInput, + }), + }; + + const requestHeaders: HeadersInit = new Headers(); + requestHeaders.set("accept", "text/plain"); + requestHeaders.set("x-api-key", keys[0]); + requestHeaders.set("x-openai-key", keys[1]); + requestHeaders.set("content-type", "application/json"); + + // This function will find matching parameters in both json objects and populate the matches + // list with the key and the value (response: ApiResponse, nodeData: The model's node data returned by our database) + function findPropertyMatches(response, nodeData) { + // Extract key names and values from the first JSON object + const keyValues = response.data[0]; + + // Initialize an array to store matches with values + const matches = []; + + // Iterate over the 'data' array in the second JSON object + nodeData.nodes.forEach((node) => { + node.data.forEach((dataItem) => { + // Check if the 'value' key exists + if (dataItem.hasOwnProperty("value")) { + // Check if the value matches any key names from the first JSON object + const keyName = dataItem.value; + if (keyValues.hasOwnProperty(keyName)) { + matches.push({ key: keyName, value: keyValues[keyName] }); + } + } + }); + }); + console.log(matches); + return matches; + } + + const response = fetch("https://api.realestateapi.com/v2/PropGPT", { + method: "POST", + headers: requestHeaders, + body: JSON.stringify({ + size: 25, + query: input.userInput, + }), + }) + .then((response) => response.json()) + .then((response) => { + /* Do something with the response */ + console.log(response); + return findPropertyMatches(response, nodeData); + }) + .catch((err) => console.error(err)); + }), +}); From dea645c8396da95f116f06cf812e557d25123ff9 Mon Sep 17 00:00:00 2001 From: eth9n-dev Date: Sat, 27 Apr 2024 22:13:45 -0700 Subject: [PATCH 6/6] GPTSearch: bugfixes --- src/app/models/_components/gpt-search.tsx | 14 +++---- .../models/editor/[modelId]/search/page.tsx | 38 ++++++++++++++++--- src/server/api/routers/propertySearch.ts | 2 +- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/src/app/models/_components/gpt-search.tsx b/src/app/models/_components/gpt-search.tsx index fe505eb..8bccda7 100644 --- a/src/app/models/_components/gpt-search.tsx +++ b/src/app/models/_components/gpt-search.tsx @@ -1,18 +1,16 @@ -"use client"; +// @ts-nocheck import React, { useState } from "react"; import { useModelNodesContext } from "~/app/_context/model-context"; import { Button } from "~/components/ui/button"; import { api } from "~/trpc/react"; -interface SearchResult { - // Define your search result interface here based on your API response - // For demonstration purposes, let's assume it's just a string - result: string; +interface GptSearchPageProps { + onResults: (results: JSON) => JSON; } -const GptSearchPage: React.FC = ({}) => { +const GptSearchPage: React.FC = ({ onResults }) => { const [query, setQuery] = useState(""); - const [searchResult, setSearchResult] = useState(null); + const [searchResult, setSearchResult] = useState(null); const fetchProperties = api.propertySearch.search.useMutation(); const nodes = { nodes: [ @@ -131,6 +129,7 @@ const GptSearchPage: React.FC = ({}) => { userInput: query, }); console.log(result); + onResults(result); }; return ( @@ -172,3 +171,4 @@ const GptSearchPage: React.FC = ({}) => { }; export default GptSearchPage; + diff --git a/src/app/models/editor/[modelId]/search/page.tsx b/src/app/models/editor/[modelId]/search/page.tsx index 6f1a162..95beddb 100644 --- a/src/app/models/editor/[modelId]/search/page.tsx +++ b/src/app/models/editor/[modelId]/search/page.tsx @@ -1,14 +1,42 @@ -import React from "react"; +// @ts-nocheck +"use client" +import React, { useState } from "react"; import GptSearchPage from "~/app/models/_components/gpt-search"; import PropertyCard from "~/app/models/_components/property-card"; -function page() { + + +function Page() { + const [propertyData, setPropertyData] = useState([]); + + function onResultUpdate(data) { + // The data returned will be an array of key value pairs ex: ["assessedValue": "10000"] + /* We could possibly format the returned data to be: + + ["address": "example address", + "price": "10000000", + "propDetails": {[]}] + + Then use a map to unravel the data to the PropertyCard component and populate it with whatever params we need + + */ + setPropertyData(data); + }; + return (
- - + {propertyData.map((property, index) => ( + + ))} +
); } -export default page; +export default Page; diff --git a/src/server/api/routers/propertySearch.ts b/src/server/api/routers/propertySearch.ts index 893647f..8ff443a 100644 --- a/src/server/api/routers/propertySearch.ts +++ b/src/server/api/routers/propertySearch.ts @@ -10,7 +10,7 @@ export const propertySearchRouter = createTRPCRouter({ .input(z.object({ nodes: z.string(), userInput: z.string() })) .mutation(async ({ input }) => { const nodeData = JSON.parse(input.nodes); - console.log("DATA==========", nodeData); + console.log("DATA==========", input.userInput); const options: RequestInit = { method: "POST", headers: {