Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11,484 changes: 10,877 additions & 607 deletions package-lock.json

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions recipes/_ts/ai_agent/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const getConfig = () => ({
framework: "nextjs",

sourceDir: {
main: "app",
components: "components",
hooks: "hooks",
lib: "lib",
},

canAdd: {
app: true,
components: true,
hooks: true,
lib: true,
},

buildDir: ".next",
});

const getModulesList = () => [
"agent"
];

const getDevModulesList = () => [
"agentDev"
];

module.exports = {
getConfig,
getModulesList,
getDevModulesList,
};
36 changes: 36 additions & 0 deletions recipes/_ts/ai_agent/snippets/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
21 changes: 21 additions & 0 deletions recipes/_ts/ai_agent/snippets/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 l3-squad

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
14 changes: 14 additions & 0 deletions recipes/_ts/ai_agent/snippets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## dynamic app name

This App using currently using

```bash
npm run dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.


In case .env.local is missing, please add it manually.
21 changes: 21 additions & 0 deletions recipes/_ts/ai_agent/snippets/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "",
"css": "app/globals.css",
"baseColor": "zinc",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}
16 changes: 16 additions & 0 deletions recipes/_ts/ai_agent/snippets/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
});

const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
];

export default eslintConfig;
31 changes: 31 additions & 0 deletions recipes/_ts/ai_agent/snippets/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const shell = require("shelljs");

const layout = require("./sources/layout");

const sourceCodes = {
layout,
};

const getFileContent = (fileName) => {
return shell.cat(`${__dirname}/${fileName}`).toString();
};

const getDynamicSourceCode = (fileName, appName, baseConfig = {}) => {
const key = fileName
.replace(/\.(ts|tsx|js|css)$/, "")
.split("/")
.pop();

const source = sourceCodes[key];

if (!source) {
throw new Error(`Source template not found: ${fileName}`);
}

return source.getSourceCode(appName, baseConfig);
};

module.exports = {
getFileContent,
getDynamicSourceCode,
};
10 changes: 10 additions & 0 deletions recipes/_ts/ai_agent/snippets/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
turbopack: {
root: __dirname,
},

};

export default nextConfig;
5 changes: 5 additions & 0 deletions recipes/_ts/ai_agent/snippets/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const config = {
plugins: ["@tailwindcss/postcss"],
};

export default config;
38 changes: 38 additions & 0 deletions recipes/_ts/ai_agent/snippets/sources/app/api/chat/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// app/api/chat/route.ts
export async function POST(req: Request) {
try {
const { messages } = await req.json();

// Get the last user message
const lastMessage = messages[messages.length - 1];
const userText = lastMessage?.content?.[0]?.text || "Hello";

// Create a simple text response
const dummyResponse = `You said: "${userText}". This is a dummy response to test the UI!

Here are some features:

• Message streaming works ✓
• Markdown formatting works ✓
• **This is bold text** and *this is italic*

Try asking me anything!`;

// Return plain JSON response
return Response.json({
role: "assistant",
content: [
{
type: "text",
text: dummyResponse,
},
],
});
} catch (error) {
console.error("Chat API Error:", error);
return Response.json(
{ error: "Failed to process request" },
{ status: 500 }
);
}
}
71 changes: 71 additions & 0 deletions recipes/_ts/ai_agent/snippets/sources/app/assistant.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"use client";

import { AssistantRuntimeProvider } from "@assistant-ui/react";
import { Thread } from "@/components/agent/thread";
import {
SidebarInset,
SidebarProvider,
SidebarTrigger,
} from "@/components/ui/sidebar";
import { ThreadListSidebar } from "@/components/agent/threadlist-sidebar";
import { Separator } from "@/components/ui/separator";
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/components/ui/breadcrumb";
import { Clock } from "lucide-react";

import { useChatRuntime } from "@/hooks/useChatRuntime";

export const Assistant = () => {
const { runtime, quotaInfo } = useChatRuntime();

return (
<AssistantRuntimeProvider runtime={runtime}>
<SidebarProvider>
<div className="flex h-dvh w-full pr-0.5">
<ThreadListSidebar />

<SidebarInset>
<header className="flex h-16 items-center gap-2 border-b px-4">
<SidebarTrigger />
<Separator orientation="vertical" className="mr-2 h-4" />

<Breadcrumb>
<BreadcrumbList>
<BreadcrumbSeparator className="hidden md:block" />
<BreadcrumbItem>
<BreadcrumbPage>Gemini</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>

{/* Quota Indicator */}
{quotaInfo && (
<div className="ml-auto flex items-center gap-2 text-sm">
{quotaInfo.can_request ? (
<span className="text-green-600 dark:text-green-400">
{quotaInfo.remaining_requests} requests left
</span>
) : (
<span className="flex items-center gap-1 text-orange-500">
<Clock className="h-4 w-4" />
Wait {quotaInfo.retry_after_seconds}s
</span>
)}
</div>
)}
</header>

<div className="flex-1 overflow-hidden">
<Thread />
</div>
</SidebarInset>
</div>
</SidebarProvider>
</AssistantRuntimeProvider>
);
};
Binary file not shown.
Loading