-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
3,093 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
.yarn/install-state.gz | ||
|
||
# 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 | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { createOpenAI } from "@ai-sdk/openai"; | ||
import { createEdgeRuntimeAPI } from "@assistant-ui/react/edge"; | ||
|
||
export const maxDuration = 30; | ||
|
||
export const { POST } = createEdgeRuntimeAPI({ | ||
model: ({ apiKey, modelName }) => { | ||
if (!apiKey) throw new Error("apiKey is required"); | ||
if (!modelName) throw new Error("modelName is required"); | ||
return createOpenAI({ apiKey })(modelName as any); | ||
}, | ||
}); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { Metadata } from "next"; | ||
import { Inter } from "next/font/google"; | ||
|
||
import "./globals.css"; | ||
|
||
const inter = Inter({ subsets: ["latin"] }); | ||
|
||
export const metadata: Metadata = { | ||
title: "Create Next App", | ||
description: "Generated by create next app", | ||
}; | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: Readonly<{ | ||
children: React.ReactNode; | ||
}>) { | ||
return ( | ||
<html lang="en"> | ||
<body className={inter.className}>{children}</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
"use client"; | ||
|
||
import { | ||
AssistantPlayground, | ||
requestOptionsFromOpenAI, | ||
} from "@assistant-ui/react-playground"; | ||
import { usePlaygroundRuntime } from "@assistant-ui/react-playground"; | ||
import { AssistantRuntimeProvider } from "@assistant-ui/react"; | ||
|
||
export default function Home() { | ||
const runtime = usePlaygroundRuntime({ | ||
api: "/api/chat", | ||
initialMessages: [], | ||
}); | ||
|
||
const handleLoadTestData = () => { | ||
runtime.thread.setRequestData( | ||
requestOptionsFromOpenAI({ | ||
model: "gpt-4o", | ||
messages: [ | ||
{ | ||
role: "user", | ||
content: "Write a poem about the weather", | ||
}, | ||
{ | ||
role: "assistant", | ||
content: "The weather is sunny and warm.", | ||
}, | ||
], | ||
}), | ||
); | ||
}; | ||
|
||
return ( | ||
<AssistantRuntimeProvider runtime={runtime}> | ||
<div className="flex h-dvh flex-col overflow-hidden"> | ||
<div className="mx-4 flex items-center justify-between border-b py-4"> | ||
<h1 className="text-2xl font-bold">Playground</h1> | ||
<button | ||
className="bg-aui-foreground px-4 py-2" | ||
onClick={handleLoadTestData} | ||
> | ||
Load Test Data | ||
</button> | ||
</div> | ||
<div className="flex-grow overflow-hidden"> | ||
<div className="flex h-full flex-col overflow-scroll"> | ||
<AssistantPlayground /> | ||
</div> | ||
</div> | ||
</div> | ||
</AssistantRuntimeProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
|
||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "with-playground", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint" | ||
}, | ||
"dependencies": { | ||
"@ai-sdk/openai": "^0.0.36", | ||
"@assistant-ui/react": "workspace:*", | ||
"@assistant-ui/react-playground": "workspace:*", | ||
"next": "14.2.5", | ||
"react": "^18", | ||
"react-dom": "^18", | ||
"tailwindcss-animate": "^1.0.7" | ||
}, | ||
"devDependencies": { | ||
"@assistant-ui/tsconfig": "workspace:^", | ||
"@types/node": "^20", | ||
"@types/react": "^18", | ||
"@types/react-dom": "^18", | ||
"eslint": "^8", | ||
"eslint-config-next": "14.2.5", | ||
"postcss": "^8", | ||
"tailwindcss": "^3.4.4", | ||
"typescript": "^5" | ||
}, | ||
"packageManager": "[email protected]+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** @type {import('postcss-load-config').Config} */ | ||
const config = { | ||
plugins: { | ||
tailwindcss: {}, | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { Config } from "tailwindcss"; | ||
|
||
const config = { | ||
darkMode: ["class"], | ||
content: [ | ||
"./pages/**/*.{ts,tsx}", | ||
"./components/**/*.{ts,tsx}", | ||
"./app/**/*.{ts,tsx}", | ||
"./src/**/*.{ts,tsx}", | ||
"./node_modules/@assistant-ui/react-playground/{dist,src}/**/*.{js,ts,tsx}", | ||
], | ||
plugins: [ | ||
require("tailwindcss-animate"), | ||
require("@assistant-ui/react/tailwindcss")({ components: ["base"] }), | ||
], | ||
} satisfies Config; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"extends": "@assistant-ui/tsconfig/base.json", | ||
"compilerOptions": { | ||
"target": "ES6", | ||
"incremental": true, | ||
"plugins": [ | ||
{ | ||
"name": "next" | ||
} | ||
], | ||
"paths": { | ||
"@/*": ["./*"], | ||
|
||
}, | ||
"allowJs": true, | ||
"strictNullChecks": true, | ||
"jsx": "preserve" | ||
}, | ||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `@assistant-ui/react-playground` | ||
|
||
A playground runtime for `@assistant-ui/react`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"$schema": "https://ui.shadcn.com/schema.json", | ||
"style": "default", | ||
"rsc": true, | ||
"tsx": true, | ||
"tailwind": { | ||
"config": "tailwind.config.ts", | ||
"css": "app/globals.css", | ||
"baseColor": "zinc", | ||
"cssVariables": true, | ||
"prefix": "" | ||
}, | ||
"aliases": { | ||
"components": "@/components", | ||
"utils": "@/lib/utils" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
{ | ||
"name": "@assistant-ui/react-playground", | ||
"version": "0.0.0-alpha.0", | ||
"license": "MIT", | ||
"exports": { | ||
".": { | ||
"import": { | ||
"types": "./dist/index.d.mts", | ||
"default": "./dist/index.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
} | ||
}, | ||
"source": "./src/index.ts", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist", | ||
"README.md" | ||
], | ||
"sideEffects": false, | ||
"scripts": { | ||
"build": "tsx scripts/build.mts" | ||
}, | ||
"dependencies": { | ||
"@ai-sdk/provider": "^0.0.12", | ||
"@radix-ui/react-avatar": "^1.1.0", | ||
"@radix-ui/react-dialog": "^1.1.1", | ||
"@radix-ui/react-dropdown-menu": "^2.1.1", | ||
"@radix-ui/react-select": "^2.1.1", | ||
"@radix-ui/react-slider": "^1.2.0", | ||
"@radix-ui/react-slot": "^1.1.0", | ||
"@radix-ui/react-tooltip": "^1.1.2", | ||
"class-variance-authority": "^0.7.0", | ||
"classnames": "^2.5.1", | ||
"clsx": "^2.1.1", | ||
"lucide-react": "^0.407.0", | ||
"openai": "^4.52.7", | ||
"prismjs": "^1.29.0", | ||
"react-simple-code-editor": "^0.14.1", | ||
"react-textarea-autosize": "^8.5.3", | ||
"tailwind-merge": "^2.4.0", | ||
"zustand": "^4.5.4" | ||
}, | ||
"peerDependencies": { | ||
"@assistant-ui/react": "^0.4.4", | ||
"@types/react": "*", | ||
"react": "^18", | ||
"tailwindcss": "^3.4.4" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@types/react": { | ||
"optional": true | ||
}, | ||
"tailwindcss": { | ||
"optional": true | ||
} | ||
}, | ||
"devDependencies": { | ||
"@assistant-ui/tsconfig": "workspace:*", | ||
"@types/prismjs": "^1.26.4", | ||
"eslint": "^8", | ||
"eslint-config-next": "14.2.5", | ||
"tailwindcss": "^3.4.4", | ||
"tailwindcss-animate": "^1.0.7", | ||
"tsup": "^8.1.0", | ||
"tsx": "^4.16.2" | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
"homepage": "https://assistant-ui.com/", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Yonom/assistant-ui.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Yonom/assistant-ui/issues" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { build } from "tsup"; | ||
|
||
// JS | ||
await build({ | ||
entry: ["src/index.ts"], | ||
format: ["cjs", "esm"], | ||
dts: true, | ||
sourcemap: true, | ||
clean: true, | ||
esbuildOptions: (options) => { | ||
options.banner = { | ||
js: '"use client";', | ||
}; | ||
}, | ||
}); | ||
|
||
// await build({ | ||
// entry: ["src/tailwindcss/index.ts"], | ||
// outDir: "dist/tailwindcss", | ||
// format: ["cjs", "esm"], | ||
// dts: true, | ||
// sourcemap: true, | ||
// }); | ||
|
||
// // css | ||
|
||
// await build({ | ||
// entry: ["src/styles/tailwindcss/markdown.css"], | ||
// outDir: "dist/styles", | ||
// }); | ||
|
||
// mkdirSync("dist/styles/tailwindcss", { recursive: true }); | ||
// copyFileSync( | ||
// "src/styles/tailwindcss/markdown.css", | ||
// "dist/styles/tailwindcss/markdown.css", | ||
// ); |
Oops, something went wrong.