Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
6aceb73
Merge pull request #52 from chainable-dev/feature/state
khaosans Nov 23, 2024
08ac2c4
feat: Add web search feature using DuckDuckGo in chatbot interface
khaosans Nov 23, 2024
efa436a
fix: Resolve syntax error in handleSuggestedAction function definition
khaosans Nov 23, 2024
cf350d0
fix: Roll back handleSuggestedAction to previous implementation state
khaosans Nov 23, 2024
b5a885f
fix: Roll back to previous state of handleSuggestedAction function
khaosans Nov 23, 2024
f38bd77
fix: Correct import of GlobeIcon in multimodal-input component
khaosans Nov 23, 2024
16499ed
refactor: Simplify quote handling and improve component structure in …
khaosans Nov 23, 2024
7cb3355
style: Enhance image appearance with shadows and adjusted opacity
khaosans Nov 23, 2024
e3a2443
feat: Enable DuckDuckGo search feature in chatbot toolset
khaosans Nov 23, 2024
05d2f43
refactor: Simplify multimodal input component and improve file handli…
khaosans Nov 23, 2024
1527952
chore: Remove references to pages and update to app router structure
khaosans Nov 23, 2024
3234c6c
test: Add unit test for web search button functionality in Multimodal…
khaosans Nov 23, 2024
b1e385d
fix: Update build script to include optimize-images before next build
khaosans Nov 23, 2024
0d1fda7
chore: Update tsconfig to ignore all test files and directories
khaosans Nov 23, 2024
3688689
feat: Add clean script to package.json for pnpmm clean command
khaosans Nov 23, 2024
f497623
fix: Update clean script to use rimraf for clearing dist and .next
khaosans Nov 23, 2024
dbbf62f
fix: Ensure build process and clean script are correctly configured
khaosans Nov 23, 2024
fd9388f
fix: Update import path for generateTitleFromUserMessage in route.ts
khaosans Nov 23, 2024
0718a57
fix: Update tsconfig path for actions module resolution
khaosans Nov 23, 2024
db45949
fix: Resolve module path issues and update configurations
khaosans Nov 23, 2024
2bf2ba0
fix: Resolve syntax errors in chat.tsx to enable successful compilation
khaosans Nov 23, 2024
789ad76
fix: Correct JSX syntax in chat.tsx to resolve build error
khaosans Nov 23, 2024
85c288f
feat: Refactor chat component to improve file upload handling and types
khaosans Nov 23, 2024
1a7f17f
fix: Resolve syntax issues in chat.tsx file
khaosans Nov 23, 2024
1dba05d
feat: Update chat component to handle message types and improve appen…
khaosans Nov 23, 2024
cb872ef
refactor: Simplify Chat component by updating types and removing unus…
khaosans Nov 23, 2024
4ac824a
fix bugs
khaosans Nov 23, 2024
f78ee28
feat: Add web search feature toggle to Chat component
khaosans Nov 23, 2024
f679117
fix: Import WalletIcon in chat.tsx to resolve build issue
khaosans Nov 23, 2024
cbaabfb
feat: Enhance multimodal input with wallet balance check and web sear…
khaosans Nov 23, 2024
55a3aaf
fix: Correct import path for WalletIcon component in multimodal-input…
khaosans Nov 23, 2024
4cf6db2
feat: Enhance multimodal input with web search and improved UI elements
khaosans Nov 23, 2024
a4a4ba2
fix: Update Wallet icon import and usage to WalletIcon in component
khaosans Nov 23, 2024
9b31049
feat: Add MultimodalInputProps and AppendOptions interfaces
khaosans Nov 23, 2024
6202324
feat: Add hover animations and info tooltips to multimodal input comp…
khaosans Nov 23, 2024
601c47b
test: Add tests for MultimodalInput component functionality
khaosans Nov 23, 2024
720c010
test: Add tests for web search toggle and file upload functionality
khaosans Nov 23, 2024
00991c1
test: Add tests for web search toggle, file upload, and placeholders
khaosans Nov 23, 2024
6391be1
refactor: Update imports and remove unused code in overview.tsx, hove…
khaosans Nov 23, 2024
5a2a13e
Fix import paths and order issues
khaosans Nov 23, 2024
d9fd6e2
Refactor icon imports and update custom icons
khaosans Nov 23, 2024
daa4fe6
Merge pull request #53 from chainable-dev/feature/state
khaosans Nov 23, 2024
dbaa1d0
Refactor icon imports and update custom icons
khaosans Nov 23, 2024
54ca89e
Refactor icon imports and update custom icons
khaosans Nov 23, 2024
1fcb4d8
feat: Replace custom icons with react-icons and improve accessibility
khaosans Nov 23, 2024
ed34738
fix: Remove TooltipContent imports from components using updated tool…
khaosans Nov 23, 2024
6bf474e
fix: Replace TooltipContent with BetterTooltip in multiple components
khaosans Nov 23, 2024
53d9094
fix: Correct TypeScript errors in chat API and sidebar components
khaosans Nov 23, 2024
41d56d3
fix: Resolve TypeScript errors in chat API and sidebar components
khaosans Nov 23, 2024
9d46906
fix: Resolve TypeScript errors in chat history and sidebar components
khaosans Nov 23, 2024
3bc9aa2
Refactor icon imports and update custom icons
khaosans Nov 23, 2024
1167b3e
fix bugs
khaosans Nov 23, 2024
820d481
Merge pull request #54 from chainable-dev/feature/websearch
khaosans Nov 23, 2024
60413c9
feat: Integrate Clerk's SignIn and SignUp components for authentication
khaosans Nov 24, 2024
ce801b5
refactor: Remove TooltipProvider from SidebarProvider component
khaosans Nov 24, 2024
746fca7
fix: Ensure TooltipContent is used within Tooltip to resolve error
khaosans Nov 24, 2024
a923f62
style: Update chat interface styling for consistency and improved aes…
khaosans Nov 24, 2024
bbdc496
feat: Integrate Agentic Modal and WebSocket state management into too…
khaosans Nov 24, 2024
0797a6f
fix: Correct SEARCH/REPLACE block for Toolbar component in toolbar.tsx
khaosans Nov 24, 2024
fc2abe0
fix: Correct return statement placement in Toolbar component to resol…
khaosans Nov 24, 2024
b11aa67
fix: Correct misplaced return statement in ToolbarComponent function
khaosans Nov 24, 2024
9605894
fix: Remove duplicate import of useState in toolbar.tsx
khaosans Nov 24, 2024
55859d7
fix: Remove duplicate export statement in toolbar.tsx
khaosans Nov 24, 2024
5ad3685
fix: Ensure Tooltip components are wrapped within TooltipProvider
khaosans Nov 24, 2024
6bbc102
fix: Wrap Tooltip components with TooltipProvider to resolve runtime …
khaosans Nov 24, 2024
b9e7291
fix: Wrap Tooltip components with TooltipProvider to resolve runtime …
khaosans Nov 24, 2024
b429017
feat: Export Tooltip components for proper usage in other modules
khaosans Nov 24, 2024
394b79a
refactor: Rename BetterTooltip to BetterTooltipComponent for clarity
khaosans Nov 24, 2024
4c8389f
fix: Update middleware to replace authMiddleware with manual logging …
khaosans Nov 24, 2024
d197a7e
fix: Restore original middleware implementation in lib/supabase/middl…
khaosans Nov 24, 2024
756664f
feat: Replace custom middleware with Clerk's auth middleware
khaosans Nov 24, 2024
cd0b1f4
fix: Replace authMiddleware with custom middleware function in middle…
khaosans Nov 24, 2024
3f6c8ab
fix: Rename duplicate export 'Tooltip' to 'TooltipRoot' in tooltip.tsx
khaosans Nov 24, 2024
53fe73a
feat: Add new file 'next-env.d.ts'
khaosans Nov 25, 2024
3bf4c58
compile
khaosans Nov 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
# OpenAI Configuration
# Get your OpenAI API Key here: https://platform.openai.com/account/api-keys
OPENAI_API_KEY=your_openai_api_key_here
NEXT_PUBLIC_OPENAI_API_KEY=your_openai_api_key_here

# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url_here
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key_here
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key_here

# Vercel Blob Storage
BLOB_READ_WRITE_TOKEN=your_blob_token_here

# Coinbase Developer Platform
# See https://www.coinbase.com/developer-platform/products/base-node
NEXT_PUBLIC_CDP_API_KEY=your_cdp_api_key_here
NEXT_PUBLIC_CDP_API_KEY_NAME=your_cdp_key_name_here
NEXT_PUBLIC_CDP_API_KEY_PRIVATE_KEY=your_cdp_private_key_here

NEXT_PUBLIC_OPENAI_API_KEY=your_openai_api_key_here

# Environment
NEXT_PUBLIC_ENVIRONMENT=localhost
NEXT_PUBLIC_SITE_URL=http://localhost:3000

# WalletConnect
# See https://cloud.walletconnect.com/
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=your_wallet_connect_project_id_here

# CDP Configuration
NEXT_PUBLIC_CDP_API_KEY_NAME=your_cdp_api_key_name_here
NEXT_PUBLIC_CDP_API_KEY_PRIVATE_KEY=your_cdp_private_key_here

# Vercel KV (Redis) Configuration
KV_URL=your_kv_url_here
KV_REST_API_URL=your_kv_rest_api_url_here
KV_REST_API_TOKEN=your_kv_api_token_here
KV_REST_API_TOKEN=your_kv_token_here
KV_REST_API_READ_ONLY_TOKEN=your_kv_readonly_token_here

# Base Network Configuration
Expand All @@ -47,7 +47,20 @@ DEBANK_API_KEY=your_debank_api_key_here
NEXT_PUBLIC_ALCHEMY_API_KEY=your_alchemy_api_key_here
BING_API_KEY=your_bing_api_key_here
DUCKDUCKGO_API_KEY=your_duckduckgo_api_key_here
SERP_API_KEY=your_serp_api_key_here

# Supabase Service Role
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key_here

# Feature Flags
NEXT_PUBLIC_FEATURE_ATTACHMENTS=true
NEXT_PUBLIC_FEATURE_WEB_SEARCH=true
NEXT_PUBLIC_FEATURE_WEB_SEARCH=true

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key_here
CLERK_SECRET_KEY=your_clerk_secret_key_here
CLERK_JWT_TEMPLATE=supabase

//ad the others

JWKS_URL=https://cute-stallion-6.clerk.accounts.dev/.well-known/jwks.json
JWT_PUBLIC_KEY=your_jwt_public_key_here
11 changes: 11 additions & 0 deletions api/websocket.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const createWebSocket = (url: string) => {
const ws = new WebSocket(url);

const send = (data: any) => {
if (ws.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify(data));
}
};

return { ws, send };
};
15 changes: 15 additions & 0 deletions app/(auth)/auth/callback/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { createRouteHandlerClient } from "@supabase/auth-helpers-nextjs";
import { cookies } from "next/headers";
import { NextResponse } from "next/server";

export async function GET(request: Request) {
const requestUrl = new URL(request.url);
const code = requestUrl.searchParams.get("code");

if (code) {
const supabase = createRouteHandlerClient({ cookies });
await supabase.auth.exchangeCodeForSession(code);
}

return NextResponse.redirect(new URL("/", requestUrl.origin));
}
47 changes: 24 additions & 23 deletions app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
import { Metadata } from "next";
"use client";

export const metadata: Metadata = {
title: "Chainable",
description: "Secure blockchain integration with AI",
icons: {
icon: [
{ url: "/icons/chainable.svg", type: "image/svg+xml", sizes: "any" },
{ url: "/icons/chainable-32.png", sizes: "32x32", type: "image/png" },
{ url: "/icons/chainable-16.png", sizes: "16x16", type: "image/png" },
],
apple: [{ url: "/icons/chainable-180.png", sizes: "180x180" }],
shortcut: "/icons/favicon.ico",
},
};
import { ClerkProvider } from "@clerk/nextjs";
import { dark } from "@clerk/themes";
import { useTheme } from "next-themes";

export default function AuthLayout({
children,
}: {
children: React.ReactNode;
}) {
const { theme } = useTheme();

return (
<html lang="en" suppressHydrationWarning>
<head>
<link rel="icon" href="/icons/chainable.svg" type="image/svg+xml" />
<link rel="alternate icon" href="/icons/favicon.ico" />
<link rel="apple-touch-icon" href="/icons/chainable-180.png" />
</head>
<body className="antialiased" suppressHydrationWarning>
<ClerkProvider
appearance={{
baseTheme: theme === "dark" ? dark : undefined,
elements: {
card: "bg-background",
headerTitle: "text-foreground",
headerSubtitle: "text-muted-foreground",
socialButtonsBlockButton: "text-foreground",
formButtonPrimary: "bg-primary text-primary-foreground hover:bg-primary/90",
footerAction: "text-muted-foreground",
formFieldLabel: "text-foreground",
formFieldInput: "bg-background text-foreground",
},
}}
>
<div className="flex min-h-screen items-center justify-center">
{children}
</body>
</html>
</div>
</ClerkProvider>
);
}
104 changes: 9 additions & 95 deletions app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,100 +1,14 @@
"use client";

import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { toast } from "sonner";
import { Loader2 } from "lucide-react";

import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { signIn } from "@/db/auth";
import { SignIn } from "@clerk/nextjs";

export default function LoginPage() {
const [isLoading, setIsLoading] = useState(false);
const [isTransitioning, setIsTransitioning] = useState(false);
const router = useRouter();

async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault();
setIsLoading(true);

try {
const formData = new FormData(event.currentTarget);
const email = formData.get("email") as string;
const password = formData.get("password") as string;

await signIn(email, password);
setIsTransitioning(true);
router.push("/");
router.refresh();
} catch (error: any) {
toast.error(error.message);
setIsLoading(false);
}
}

if (isTransitioning) {
return (
<div className="fixed inset-0 flex items-center justify-center bg-background">
<div className="space-y-4 text-center">
<Loader2 className="h-8 w-8 animate-spin" />
<p className="text-sm text-muted-foreground">Redirecting...</p>
</div>
</div>
);
}

return (
<div className="flex h-[calc(100vh-theme(spacing.16))] items-center justify-center py-10">
<div className="w-full max-w-sm space-y-6">
<div className="space-y-2 text-center">
<h1 className="text-3xl font-bold">Login</h1>
<p className="text-gray-500 dark:text-gray-400">
Enter your email below to login to your account
</p>
</div>
<form className="space-y-4" onSubmit={handleSubmit}>
<div className="space-y-2">
<Label htmlFor="email">Email</Label>
<Input
id="email"
name="email"
placeholder="m@example.com"
required
type="email"
disabled={isLoading}
/>
</div>
<div className="space-y-2">
<Label htmlFor="password">Password</Label>
<Input
id="password"
name="password"
required
type="password"
disabled={isLoading}
/>
</div>
<Button className="w-full" disabled={isLoading}>
{isLoading ? (
<>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Signing in...
</>
) : (
"Sign in"
)}
</Button>
</form>
<div className="text-center text-sm">
Don&apos;t have an account?{" "}
<Link className="underline" href="/register">
Register
</Link>
</div>
</div>
</div>
);
return (
<SignIn
path="/login"
routing="path"
signUpUrl="/register"
afterSignInUrl="/"
/>
);
}
15 changes: 15 additions & 0 deletions app/(auth)/metadata.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Metadata } from "next";

export const metadata: Metadata = {
title: "Chainable",
description: "Secure blockchain integration with AI",
icons: {
icon: [
{ url: "/icons/chainable.svg", type: "image/svg+xml", sizes: "any" },
{ url: "/icons/chainable-32.png", sizes: "32x32", type: "image/png" },
{ url: "/icons/chainable-16.png", sizes: "16x16", type: "image/png" },
],
apple: [{ url: "/icons/chainable-180.png", sizes: "180x180" }],
shortcut: "/icons/favicon.ico",
},
};
77 changes: 9 additions & 68 deletions app/(auth)/register/page.tsx
Original file line number Diff line number Diff line change
@@ -1,73 +1,14 @@
"use client";

import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { toast } from "sonner";

import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { signUp } from "@/db/auth";
import { SignUp } from "@clerk/nextjs";

export default function RegisterPage() {
const [isLoading, setIsLoading] = useState(false);
const router = useRouter();

async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault();
setIsLoading(true);

try {
const formData = new FormData(event.currentTarget);
const email = formData.get("email") as string;
const password = formData.get("password") as string;

await signUp(email, password);
toast.success("Check your email to confirm your account");
router.push("/login");
} catch (error: any) {
toast.error(error.message);
} finally {
setIsLoading(false);
}
}

return (
<div className="flex h-[calc(100vh-theme(spacing.16))] items-center justify-center py-10">
<div className="w-full max-w-sm space-y-6">
<div className="space-y-2 text-center">
<h1 className="text-3xl font-bold">Register</h1>
<p className="text-gray-500 dark:text-gray-400">
Enter your information to create an account
</p>
</div>
<form className="space-y-4" onSubmit={handleSubmit}>
<div className="space-y-2">
<Label htmlFor="email">Email</Label>
<Input
id="email"
name="email"
placeholder="m@example.com"
required
type="email"
/>
</div>
<div className="space-y-2">
<Label htmlFor="password">Password</Label>
<Input id="password" name="password" required type="password" />
</div>
<Button className="w-full" disabled={isLoading}>
{isLoading ? "Loading..." : "Register"}
</Button>
</form>
<div className="text-center text-sm">
Already have an account?{" "}
<Link className="underline" href="/login">
Login
</Link>
</div>
</div>
</div>
);
return (
<SignUp
path="/register"
routing="path"
signInUrl="/login"
afterSignUpUrl="/"
/>
);
}
1 change: 1 addition & 0 deletions app/(auth)/sign-in/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading