Spaces:
Running
Running
use storage for the ask-ai landing
Browse files
components/ask-ai/ask-ai-landing.tsx
CHANGED
|
@@ -1,25 +1,32 @@
|
|
| 1 |
"use client";
|
| 2 |
import { ArrowUp } from "lucide-react";
|
| 3 |
import { useState } from "react";
|
| 4 |
-
import {
|
| 5 |
import { useRouter } from "next/navigation";
|
| 6 |
|
| 7 |
import { Button } from "@/components/ui/button";
|
| 8 |
import { ProviderType } from "@/lib/type";
|
| 9 |
import { Models } from "./models";
|
| 10 |
-
import {
|
| 11 |
import { cn } from "@/lib/utils";
|
| 12 |
-
import { AiLoading } from "./loading";
|
| 13 |
-
import { EXAMPLES_OF_PROJECT_SUGGESTIONS } from "@/lib/prompts";
|
| 14 |
|
| 15 |
export function AskAiLanding({ className }: { className?: string }) {
|
| 16 |
-
const [model, setModel] =
|
|
|
|
|
|
|
|
|
|
| 17 |
const [provider, setProvider] = useLocalStorage<ProviderType>(
|
| 18 |
-
"provider",
|
| 19 |
"auto" as ProviderType
|
| 20 |
);
|
| 21 |
const router = useRouter();
|
| 22 |
const [prompt, setPrompt] = useState<string>("");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
return (
|
| 24 |
<div
|
| 25 |
className={cn(
|
|
@@ -42,12 +49,14 @@ export function AskAiLanding({ className }: { className?: string }) {
|
|
| 42 |
/>
|
| 43 |
<footer className="flex items-center justify-between">
|
| 44 |
<div className="flex items-center gap-2">
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
| 51 |
</div>
|
| 52 |
<div>
|
| 53 |
<Button
|
|
|
|
| 1 |
"use client";
|
| 2 |
import { ArrowUp } from "lucide-react";
|
| 3 |
import { useState } from "react";
|
| 4 |
+
import { useLocalStorage, useMount } from "react-use";
|
| 5 |
import { useRouter } from "next/navigation";
|
| 6 |
|
| 7 |
import { Button } from "@/components/ui/button";
|
| 8 |
import { ProviderType } from "@/lib/type";
|
| 9 |
import { Models } from "./models";
|
| 10 |
+
import { DEFAULT_MODEL } from "@/lib/providers";
|
| 11 |
import { cn } from "@/lib/utils";
|
|
|
|
|
|
|
| 12 |
|
| 13 |
export function AskAiLanding({ className }: { className?: string }) {
|
| 14 |
+
const [model = DEFAULT_MODEL, setModel] = useLocalStorage<string>(
|
| 15 |
+
"deepsite-model",
|
| 16 |
+
DEFAULT_MODEL
|
| 17 |
+
);
|
| 18 |
const [provider, setProvider] = useLocalStorage<ProviderType>(
|
| 19 |
+
"deepsite-provider",
|
| 20 |
"auto" as ProviderType
|
| 21 |
);
|
| 22 |
const router = useRouter();
|
| 23 |
const [prompt, setPrompt] = useState<string>("");
|
| 24 |
+
const [mounted, setMounted] = useState<boolean>(false);
|
| 25 |
+
|
| 26 |
+
useMount(() => {
|
| 27 |
+
setMounted(true);
|
| 28 |
+
});
|
| 29 |
+
|
| 30 |
return (
|
| 31 |
<div
|
| 32 |
className={cn(
|
|
|
|
| 49 |
/>
|
| 50 |
<footer className="flex items-center justify-between">
|
| 51 |
<div className="flex items-center gap-2">
|
| 52 |
+
{mounted && (
|
| 53 |
+
<Models
|
| 54 |
+
model={model}
|
| 55 |
+
setModel={setModel}
|
| 56 |
+
provider={provider as ProviderType}
|
| 57 |
+
setProvider={setProvider}
|
| 58 |
+
/>
|
| 59 |
+
)}
|
| 60 |
</div>
|
| 61 |
<div>
|
| 62 |
<Button
|
components/chat/index.tsx
CHANGED
|
@@ -147,7 +147,7 @@ export function AppEditorChat({
|
|
| 147 |
}
|
| 148 |
|
| 149 |
return (
|
| 150 |
-
<code className="font-mono bg-
|
| 151 |
{children}
|
| 152 |
</code>
|
| 153 |
);
|
|
|
|
| 147 |
}
|
| 148 |
|
| 149 |
return (
|
| 150 |
+
<code className="font-mono bg-primary/10 text-primary text-[10px] px-1.5 py-0.5 rounded-md">
|
| 151 |
{children}
|
| 152 |
</code>
|
| 153 |
);
|
components/projects/project-card.tsx
CHANGED
|
@@ -1,10 +1,23 @@
|
|
| 1 |
import { SpaceEntry } from "@huggingface/hub";
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
export function ProjectCard({ project }: { project: SpaceEntry }) {
|
| 4 |
return (
|
| 5 |
<a href={`/deepsite/${project.name}`}>
|
| 6 |
<div className="flex items-center justify-start gap-3 border-2 border-background ring-[1px] ring-border rounded-lg overflow-hidden transition-all hover:bg-accent">
|
| 7 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
{project?.cardData?.emoji || "🚀"}
|
| 9 |
</div>
|
| 10 |
<div className="flex flex-col p-0">
|
|
|
|
| 1 |
import { SpaceEntry } from "@huggingface/hub";
|
| 2 |
|
| 3 |
+
// from-red-500 to-red-500
|
| 4 |
+
// from-yellow-500 to-yellow-500
|
| 5 |
+
// from-green-500 to-green-500
|
| 6 |
+
// from-purple-500 to-purple-500
|
| 7 |
+
// from-blue-500 to-blue-500
|
| 8 |
+
// from-pink-500 to-pink-500
|
| 9 |
+
// from-gray-500 to-gray-500
|
| 10 |
+
// from-indigo-500 to-indigo-500
|
| 11 |
+
|
| 12 |
export function ProjectCard({ project }: { project: SpaceEntry }) {
|
| 13 |
return (
|
| 14 |
<a href={`/deepsite/${project.name}`}>
|
| 15 |
<div className="flex items-center justify-start gap-3 border-2 border-background ring-[1px] ring-border rounded-lg overflow-hidden transition-all hover:bg-accent">
|
| 16 |
+
<div
|
| 17 |
+
className={`size-10 bg-linear-to-br flex items-center justify-center text-lg from-${
|
| 18 |
+
project?.cardData?.colorFrom || "blue"
|
| 19 |
+
}-500 to-${project?.cardData?.colorTo || "purple"}-500`}
|
| 20 |
+
>
|
| 21 |
{project?.cardData?.emoji || "🚀"}
|
| 22 |
</div>
|
| 23 |
<div className="flex flex-col p-0">
|