mirror of
https://github.com/vercel-labs/natural-language-postgres.git
synced 2026-11-04 08:10:38 +00:00
update names
This commit is contained in:
1 parent
5f05ea4af6
commit
e1d0131040
4 files changed
+11
-11
No files matched your search
+1
-1
@@ -64,7 +64,7 @@ export const generateQuery = async (input: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const getCompanies = async (query: string) => {
|
||||
export const runGenerateSQLQuery = async (query: string) => {
|
||||
"use server";
|
||||
// Check if the query is a SELECT statement
|
||||
if (
|
||||
|
||||
+6
-6
@@ -2,15 +2,15 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { motion, AnimatePresence } from "framer-motion";
|
||||
import { generateChartConfig, generateQuery, getCompanies } from "./actions";
|
||||
import { generateChartConfig, generateQuery, runGenerateSQLQuery } from "./actions";
|
||||
import { Config, Result } from "@/lib/types";
|
||||
import { Loader2 } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
import { ProjectInfo } from "@/components/project-info";
|
||||
import { UnicornTable } from "@/components/unicorn-table";
|
||||
import { Results } from "@/components/results";
|
||||
import { SuggestedQueries } from "@/components/suggested-queries";
|
||||
import { QueryViewer } from "@/components/query-viewer";
|
||||
import { UnicornSearch } from "@/components/unicorn-search";
|
||||
import { Search } from "@/components/search";
|
||||
import { Header } from "@/components/header";
|
||||
|
||||
export default function Page() {
|
||||
@@ -42,7 +42,7 @@ export default function Page() {
|
||||
}
|
||||
setActiveQuery(query);
|
||||
setLoadingStep(2);
|
||||
const companies = await getCompanies(query);
|
||||
const companies = await runGenerateSQLQuery(query);
|
||||
const columns = companies.length > 0 ? Object.keys(companies[0]) : [];
|
||||
setResults(companies);
|
||||
setColumns(columns);
|
||||
@@ -88,7 +88,7 @@ export default function Page() {
|
||||
>
|
||||
<div className="p-6 sm:p-8 flex flex-col flex-grow">
|
||||
<Header handleClear={handleClear} />
|
||||
<UnicornSearch
|
||||
<Search
|
||||
handleClear={handleClear}
|
||||
handleSubmit={handleSubmit}
|
||||
inputValue={inputValue}
|
||||
@@ -134,7 +134,7 @@ export default function Page() {
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<UnicornTable
|
||||
<Results
|
||||
results={results}
|
||||
chartConfig={chartConfig}
|
||||
columns={columns}
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
} from "./ui/table";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./ui/tabs";
|
||||
|
||||
export const UnicornTable = ({
|
||||
export const Results = ({
|
||||
results,
|
||||
columns,
|
||||
chartConfig,
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Search } from "lucide-react";
|
||||
import { Search as SearchIcon } from "lucide-react";
|
||||
import { Button } from "./ui/button";
|
||||
import { Input } from "./ui/input";
|
||||
|
||||
export const UnicornSearch = ({
|
||||
export const Search = ({
|
||||
handleSubmit,
|
||||
inputValue,
|
||||
setInputValue,
|
||||
@@ -32,7 +32,7 @@ export const UnicornSearch = ({
|
||||
onChange={(e) => setInputValue(e.target.value)}
|
||||
className="pr-10 text-base"
|
||||
/>
|
||||
<Search className="absolute right-3 top-1/2 transform -translate-y-1/2 text-muted-foreground" />
|
||||
<SearchIcon className="absolute right-3 top-1/2 transform -translate-y-1/2 text-muted-foreground" />
|
||||
</div>
|
||||
<div className="flex sm:flex-row items-center justify-center gap-2">
|
||||
{submitted ? (
|
||||
Reference in new issue
Block a user