feat: add main screen to localhost:8080 (#625)

* feat: add main screen to localhost:8080

* update playground

* feat: use / in playground handler

* update

* fix slack link

* fix next routing

* fix lint
r0.4
Meng Zhang 2023-10-24 08:36:08 -07:00 committed by GitHub
parent 44cac0b1c0
commit 2a40d36e20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 313 additions and 221 deletions

View File

@ -11,8 +11,8 @@ import { Header } from '@/components/header'
export const metadata: Metadata = {
title: {
default: 'Tabby Playground',
template: `%s - Tabby Playground`
default: 'Tabby - Home',
template: `Tabby - %s`
},
description: 'Tabby, an opensource, self-hosted AI coding assistant.',
themeColor: [

View File

@ -0,0 +1,14 @@
import { Button, buttonVariants } from "@/components/ui/button"
import { IconSlack } from "@/components/ui/icons"
export default function IndexPage() {
return <div className="grow flex justify-center items-center">
<div className="w-2/3 lg:w-1/3 flex flex-col gap-3">
<h1 className="text-xl font-bold">Join the Tabby community</h1>
<p>Connect with other contributors building Tabby. Share knowledge, get help, and contribute to the open-source project.</p>
<p>
<a target="_blank" href="https://join.slack.com/t/tabbycommunity/shared_invite/zt-1xeiddizp-bciR2RtFTaJ37RBxr8VxpA" className={buttonVariants()}><IconSlack className="-ml-2 h-8 w-8" />Join us on Slack</a>
</p>
</div>
</div>
}

View File

@ -1,5 +1,10 @@
import { nanoid } from '@/lib/utils'
import { Chat } from '@/components/chat'
import { Metadata } from 'next'
export const metadata: Metadata = {
title: 'Playground',
}
export default function IndexPage() {
const id = nanoid()

View File

@ -19,7 +19,7 @@ export function EmptyScreen({ setInput }: Pick<UseChatHelpers, 'setInput'>) {
<div className="mx-auto max-w-2xl px-4">
<div className="rounded-lg border bg-background p-8">
<h1 className="mb-2 text-lg font-semibold">
Welcome to Tabby Playground!
Welcome to Playground!
</h1>
<p className="leading-normal text-muted-foreground">
You can start a conversation here or try the following examples:

View File

@ -6,6 +6,7 @@ import { cn } from '@/lib/utils'
import { buttonVariants } from '@/components/ui/button'
import { IconGitHub, IconExternalLink } from '@/components/ui/icons'
import dynamic from 'next/dynamic'
import Link from 'next/link'
const ThemeToggle = dynamic(
() => import('@/components/theme-toggle').then(x => x.ThemeToggle),
@ -13,10 +14,20 @@ const ThemeToggle = dynamic(
)
export function Header() {
const [isChatEnabled, setIsChatEnabled] = React.useState(false);
React.useEffect(() => {
fetchIsChatEnabled().then(setIsChatEnabled);
}, []);
return (
<header className="sticky top-0 z-50 flex items-center justify-between w-full h-16 px-4 border-b shrink-0 bg-gradient-to-b from-background/10 via-background/50 to-background/80 backdrop-blur-xl">
<div className="flex items-center">
<ThemeToggle />
<Link href="/" className={cn(buttonVariants({ variant: 'link' }))}>
Home
</Link>
{isChatEnabled && <Link href="/playground" className={cn(buttonVariants({ variant: 'link' }))}>
Playground
</Link>}
</div>
<div className="flex items-center justify-end space-x-2">
<a
@ -41,3 +52,9 @@ export function Header() {
</header>
)
}
async function fetchIsChatEnabled() {
const resp = await fetch("/v1/health");
const json = await resp.json();
return !!json.chat_model;
}

View File

@ -476,6 +476,44 @@ function IconChevronUpDown({
)
}
function IconSlack({
className,
...props
}: React.ComponentProps<'svg'>) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
className={cn('h-4 w-4', className)}
viewBox="0 0 270 270"
{...props}
>
<g>
<g>
<path style={{fill: "#E01E5A"}} d="M99.4,151.2c0,7.1-5.8,12.9-12.9,12.9c-7.1,0-12.9-5.8-12.9-12.9c0-7.1,5.8-12.9,12.9-12.9h12.9V151.2z" />
<path style={{fill: "#E01E5A"}} d="M105.9,151.2c0-7.1,5.8-12.9,12.9-12.9s12.9,5.8,12.9,12.9v32.3c0,7.1-5.8,12.9-12.9,12.9
s-12.9-5.8-12.9-12.9V151.2z"/>
</g>
<g>
<path style={{fill: "#36C5F0"}} d="M118.8,99.4c-7.1,0-12.9-5.8-12.9-12.9c0-7.1,5.8-12.9,12.9-12.9s12.9,5.8,12.9,12.9v12.9H118.8z" />
<path style={{fill: "#36C5F0"}} d="M118.8,105.9c7.1,0,12.9,5.8,12.9,12.9s-5.8,12.9-12.9,12.9H86.5c-7.1,0-12.9-5.8-12.9-12.9
s5.8-12.9,12.9-12.9H118.8z"/>
</g>
<g>
<path style={{fill: "#2EB67D"}} d="M170.6,118.8c0-7.1,5.8-12.9,12.9-12.9c7.1,0,12.9,5.8,12.9,12.9s-5.8,12.9-12.9,12.9h-12.9V118.8z" />
<path style={{fill: "#2EB67D"}} d="M164.1,118.8c0,7.1-5.8,12.9-12.9,12.9c-7.1,0-12.9-5.8-12.9-12.9V86.5c0-7.1,5.8-12.9,12.9-12.9
c7.1,0,12.9,5.8,12.9,12.9V118.8z"/>
</g>
<g>
<path style={{fill: "#ECB22E"}} d="M151.2,170.6c7.1,0,12.9,5.8,12.9,12.9c0,7.1-5.8,12.9-12.9,12.9c-7.1,0-12.9-5.8-12.9-12.9v-12.9H151.2z" />
<path style={{fill: "#ECB22E"}} d="M151.2,164.1c-7.1,0-12.9-5.8-12.9-12.9c0-7.1,5.8-12.9,12.9-12.9h32.3c7.1,0,12.9,5.8,12.9,12.9
c0,7.1-5.8,12.9-12.9,12.9H151.2z"/>
</g>
</g>
</svg>
)
}
export {
IconEdit,
IconNextChat,
@ -503,5 +541,6 @@ export {
IconShare,
IconUsers,
IconExternalLink,
IconChevronUpDown
IconChevronUpDown,
IconSlack
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[376],{15376:function(n,s,e){e.r(s),e.d(s,{ThemeToggle:function(){return c}});var l=e(57437),a=e(2265),i=e(6435),t=e(93023),r=e(84168);function c(){let{setTheme:n,theme:s}=(0,i.F)(),[e,c]=a.useTransition();return(0,l.jsxs)(t.z,{variant:"ghost",size:"icon",onClick:()=>{c(()=>{n("light"===s?"dark":"light")})},children:[s?"dark"===s?(0,l.jsx)(r.C9,{className:"transition-all"}):(0,l.jsx)(r.O3,{className:"transition-all"}):null,(0,l.jsx)("span",{className:"sr-only",children:"Toggle theme"})]})}}}]);

View File

@ -0,0 +1 @@
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[376],{15376:function(n,s,e){e.r(s),e.d(s,{ThemeToggle:function(){return r}});var l=e(57437),a=e(2265),i=e(6435),t=e(93023),o=e(84168);function r(){let{setTheme:n,theme:s}=(0,i.F)(),[e,r]=a.useTransition();return(0,l.jsxs)(t.z,{variant:"ghost",size:"icon",onClick:()=>{r(()=>{n("light"===s?"dark":"light")})},children:[s?"dark"===s?(0,l.jsx)(o.IconMoon,{className:"transition-all"}):(0,l.jsx)(o.IconSun,{className:"transition-all"}):null,(0,l.jsx)("span",{className:"sr-only",children:"Toggle theme"})]})}}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{35762:function(e,n,r){Promise.resolve().then(r.t.bind(r,58877,23)),Promise.resolve().then(r.bind(r,78963)),Promise.resolve().then(r.bind(r,78495)),Promise.resolve().then(r.t.bind(r,6928,23)),Promise.resolve().then(r.t.bind(r,33195,23)),Promise.resolve().then(r.bind(r,5925))},78963:function(e,n,r){"use strict";r.r(n),r.d(n,{Header:function(){return h}});var t=r(57437),i=r(2265),o=r(39311),s=r(93023),a=r(84168),d=r(30415),c=r.n(d),l=r(61396),u=r.n(l);let f=c()(()=>r.e(376).then(r.bind(r,15376)).then(e=>e.ThemeToggle),{loadableGenerated:{webpack:()=>[15376]},ssr:!1});function h(){let[e,n]=i.useState(!1);return i.useEffect(()=>{m().then(n)},[]),(0,t.jsxs)("header",{className:"sticky top-0 z-50 flex items-center justify-between w-full h-16 px-4 border-b shrink-0 bg-gradient-to-b from-background/10 via-background/50 to-background/80 backdrop-blur-xl",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(f,{}),(0,t.jsx)(u(),{href:"/",className:(0,o.cn)((0,s.d)({variant:"link"})),children:"Home"}),e&&(0,t.jsx)(u(),{href:"/playground",className:(0,o.cn)((0,s.d)({variant:"link"})),children:"Playground"})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end space-x-2",children:[(0,t.jsxs)("a",{target:"_blank",href:"https://github.com/TabbyML/tabby",rel:"noopener noreferrer",className:(0,o.cn)((0,s.d)({variant:"outline"})),children:[(0,t.jsx)(a.IconGitHub,{}),(0,t.jsx)("span",{className:"hidden ml-2 md:flex",children:"GitHub"})]}),(0,t.jsxs)("a",{target:"_blank",href:"/swagger-ui",rel:"noopener noreferrer",className:(0,o.cn)((0,s.d)({variant:"outline"})),children:[(0,t.jsx)(a.IconExternalLink,{}),(0,t.jsx)("span",{className:"hidden ml-2 md:flex",children:"OpenAPI"})]})]})]})}async function m(){let e=await fetch("/v1/health"),n=await e.json();return!!n.chat_model}},78495:function(e,n,r){"use strict";r.r(n),r.d(n,{Providers:function(){return s}});var t=r(57437);r(2265);var i=r(6435),o=r(95482);function s(e){let{children:n,...r}=e;return(0,t.jsx)(i.f,{...r,children:(0,t.jsx)(o.pn,{children:n})})}},93023:function(e,n,r){"use strict";r.d(n,{d:function(){return d},z:function(){return c}});var t=r(57437),i=r(2265),o=r(67256),s=r(7404),a=r(39311);let d=(0,s.j)("inline-flex items-center justify-center rounded-md text-sm font-medium shadow ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-md hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"shadow-none hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 shadow-none hover:underline"},size:{default:"h-8 px-4 py-2",sm:"h-8 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-8 w-8 p-0"}},defaultVariants:{variant:"default",size:"default"}}),c=i.forwardRef((e,n)=>{let{className:r,variant:i,size:s,asChild:c=!1,...l}=e,u=c?o.g7:"button";return(0,t.jsx)(u,{className:(0,a.cn)(d({variant:i,size:s,className:r})),ref:n,...l})});c.displayName="Button"},95482:function(e,n,r){"use strict";r.d(n,{_v:function(){return l},aJ:function(){return c},pn:function(){return a},u:function(){return d}});var t=r(57437),i=r(2265),o=r(3072),s=r(39311);let a=o.zt,d=o.fC,c=o.xz,l=i.forwardRef((e,n)=>{let{className:r,sideOffset:i=4,...a}=e;return(0,t.jsx)(o.VY,{ref:n,sideOffset:i,className:(0,s.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-xs font-medium text-popover-foreground shadow-md animate-in fade-in-50 data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",r),...a})});l.displayName=o.VY.displayName},58877:function(){}},function(e){e.O(0,[195,861,832,168,971,864,744],function(){return e(e.s=35762)}),_N_E=e.O()}]);

View File

@ -0,0 +1 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{26039:function(n,e,u){Promise.resolve().then(u.bind(u,84168))}},function(n){n.O(0,[195,168,971,864,744],function(){return n(n.s=26039)}),_N_E=n.O()}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
!function(){"use strict";var e,t,n,r,o,u,i,c,f,a={},l={};function s(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}},r=!0;try{a[e](n,n.exports,s),r=!1}finally{r&&delete l[e]}return n.exports}s.m=a,e=[],s.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u<e.length;u++){for(var n=e[u][0],r=e[u][1],o=e[u][2],c=!0,f=0;f<n.length;f++)i>=o&&Object.keys(s.O).every(function(e){return s.O[e](n[f])})?n.splice(f--,1):(c=!1,o<i&&(i=o));if(c){e.splice(u--,1);var a=r()}}return a},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},s.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);s.r(o);var u={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach(function(t){u[t]=function(){return e[t]}});return u.default=function(){return e},s.d(o,u),o},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce(function(t,n){return s.f[n](e,t),t},[]))},s.u=function(e){return"static/chunks/"+e+".2b6536d53b303d15.js"},s.miniCssF=function(e){return"static/css/6eee720a4f6b5b8e.css"},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="_N_E:",s.l=function(e,t,n,u){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var i,c,f=document.getElementsByTagName("script"),a=0;a<f.length;a++){var l=f[a];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==o+n){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,s.nc&&i.setAttribute("nonce",s.nc),i.setAttribute("data-webpack",o+n),i.src=s.tu(e)),r[e]=[t];var d=function(t,n){i.onerror=i.onload=null,clearTimeout(p);var o=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),c&&document.head.appendChild(i)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.tt=function(){return void 0===u&&(u={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(u=trustedTypes.createPolicy("nextjs#bundler",u))),u},s.tu=function(e){return s.tt().createScriptURL(e)},s.p="/_next/",i={272:0},s.f.j=function(e,t){var n=s.o(i,e)?i[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(272!=e){var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=s.p+s.u(e),u=Error();s.l(o,function(t){if(s.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",u.name="ChunkLoadError",u.type=r,u.request=o,n[1](u)}},"chunk-"+e,e)}else i[e]=0}},s.O.j=function(e){return 0===i[e]},c=function(e,t){var n,r,o=t[0],u=t[1],c=t[2],f=0;if(o.some(function(e){return 0!==i[e]})){for(n in u)s.o(u,n)&&(s.m[n]=u[n]);if(c)var a=c(s)}for(e&&e(t);f<o.length;f++)r=o[f],s.o(i,r)&&i[r]&&i[r][0](),i[r]=0;return s.O(a)},(f=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(c.bind(null,0)),f.push=c.bind(null,f.push.bind(f))}();
!function(){"use strict";var e,t,n,r,o,u,i,c,f,a={},l={};function s(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}},r=!0;try{a[e](n,n.exports,s),r=!1}finally{r&&delete l[e]}return n.exports}s.m=a,e=[],s.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u<e.length;u++){for(var n=e[u][0],r=e[u][1],o=e[u][2],c=!0,f=0;f<n.length;f++)i>=o&&Object.keys(s.O).every(function(e){return s.O[e](n[f])})?n.splice(f--,1):(c=!1,o<i&&(i=o));if(c){e.splice(u--,1);var a=r()}}return a},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},s.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);s.r(o);var u={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach(function(t){u[t]=function(){return e[t]}});return u.default=function(){return e},s.d(o,u),o},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce(function(t,n){return s.f[n](e,t),t},[]))},s.u=function(e){return"static/chunks/"+e+".fad7d92fce894ba9.js"},s.miniCssF=function(e){return"static/css/3aa519e3dd59a9b3.css"},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="_N_E:",s.l=function(e,t,n,u){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var i,c,f=document.getElementsByTagName("script"),a=0;a<f.length;a++){var l=f[a];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==o+n){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,s.nc&&i.setAttribute("nonce",s.nc),i.setAttribute("data-webpack",o+n),i.src=s.tu(e)),r[e]=[t];var d=function(t,n){i.onerror=i.onload=null,clearTimeout(p);var o=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),c&&document.head.appendChild(i)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.tt=function(){return void 0===u&&(u={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(u=trustedTypes.createPolicy("nextjs#bundler",u))),u},s.tu=function(e){return s.tt().createScriptURL(e)},s.p="/_next/",i={272:0},s.f.j=function(e,t){var n=s.o(i,e)?i[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(272!=e){var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=s.p+s.u(e),u=Error();s.l(o,function(t){if(s.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",u.name="ChunkLoadError",u.type=r,u.request=o,n[1](u)}},"chunk-"+e,e)}else i[e]=0}},s.O.j=function(e){return 0===i[e]},c=function(e,t){var n,r,o=t[0],u=t[1],c=t[2],f=0;if(o.some(function(e){return 0!==i[e]})){for(n in u)s.o(u,n)&&(s.m[n]=u[n]);if(c)var a=c(s)}for(e&&e(t);f<o.length;f++)r=o[f],s.o(i,r)&&i[r]&&i[r][0](),i[r]=0;return s.O(a)},(f=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(c.bind(null,0)),f.push=c.bind(null,f.push.bind(f))}();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,13 @@
1:HL["/_next/static/media/86fdec36ddd9097e-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
2:HL["/_next/static/media/c9a5bc6a7c948fb0-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
3:HL["/_next/static/css/3aa519e3dd59a9b3.css","style"]
0:["kTf01AW-j0xnBhHfdnMlO",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L4",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/3aa519e3dd59a9b3.css","precedence":"next"}]],"$L5"]]]]
6:I{"id":5925,"chunks":["195:static/chunks/195-42fffaf30b0aaee4.js","861:static/chunks/861-b61dfc288e31f406.js","832:static/chunks/832-06362e8382d18069.js","168:static/chunks/168-628e6130810bc4d7.js","185:static/chunks/app/layout-a3a8312b187162b4.js"],"name":"Toaster","async":false}
7:I{"id":78495,"chunks":["195:static/chunks/195-42fffaf30b0aaee4.js","861:static/chunks/861-b61dfc288e31f406.js","832:static/chunks/832-06362e8382d18069.js","168:static/chunks/168-628e6130810bc4d7.js","185:static/chunks/app/layout-a3a8312b187162b4.js"],"name":"Providers","async":false}
8:I{"id":78963,"chunks":["195:static/chunks/195-42fffaf30b0aaee4.js","861:static/chunks/861-b61dfc288e31f406.js","832:static/chunks/832-06362e8382d18069.js","168:static/chunks/168-628e6130810bc4d7.js","185:static/chunks/app/layout-a3a8312b187162b4.js"],"name":"Header","async":false}
9:I{"id":81443,"chunks":["272:static/chunks/webpack-905b6479559cc2f9.js","971:static/chunks/fd9d1056-5dfc77aa37d8c76f.js","864:static/chunks/864-bf315a5307aba1d7.js"],"name":"","async":false}
a:I{"id":18639,"chunks":["272:static/chunks/webpack-905b6479559cc2f9.js","971:static/chunks/fd9d1056-5dfc77aa37d8c76f.js","864:static/chunks/864-bf315a5307aba1d7.js"],"name":"","async":false}
c:I{"id":84168,"chunks":["195:static/chunks/195-42fffaf30b0aaee4.js","168:static/chunks/168-628e6130810bc4d7.js","931:static/chunks/app/page-3b78cb85666b4f5a.js"],"name":"IconSlack","async":false}
5:[["$","meta","0",{"charSet":"utf-8"}],["$","title","1",{"children":"Tabby - Home"}],["$","meta","2",{"name":"description","content":"Tabby, an opensource, self-hosted AI coding assistant."}],["$","meta","3",{"name":"theme-color","media":"(prefers-color-scheme: light)","content":"white"}],["$","meta","4",{"name":"theme-color","media":"(prefers-color-scheme: dark)","content":"black"}],["$","meta","5",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","6",{"name":"next-size-adjust"}]]
4:[null,["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{}],["$","body",null,{"className":"font-sans antialiased __variable_e66fe9 __variable_bd9c35","children":[["$","$L6",null,{}],["$","$L7",null,{"attribute":"class","defaultTheme":"system","enableSystem":true,"children":[["$","div",null,{"className":"flex flex-col min-h-screen","children":[["$","$L8",null,{}],["$","main",null,{"className":"flex flex-col flex-1 bg-muted/50","children":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"childProp":{"current":["$Lb",["$","div",null,{"className":"grow flex justify-center items-center","children":["$","div",null,{"className":"w-2/3 lg:w-1/3 flex flex-col gap-3","children":[["$","h1",null,{"className":"text-xl font-bold","children":"Join the Tabby community"}],["$","p",null,{"children":"Connect with other contributors building Tabby. Share knowledge, get help, and contribute to the open-source project."}],["$","p",null,{"children":["$","a",null,{"target":"_blank","href":"https://join.slack.com/t/tabbycommunity/shared_invite/zt-1xeiddizp-bciR2RtFTaJ37RBxr8VxpA","className":"inline-flex items-center justify-center rounded-md text-sm font-medium shadow ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground shadow-md hover:bg-primary/90 h-8 px-4 py-2","children":[["$","$Lc",null,{"className":"-ml-2 h-8 w-8"}],"Join us on Slack"]}]}]]}]}],null],"segment":"__PAGE__"},"styles":[]}]}]]}],null]}]]}]]}],null]
b:null

File diff suppressed because one or more lines are too long

View File

@ -1,13 +1,13 @@
0:["Gzvwjw4BLgzSr6Ef_2FTV",[[["",{"children":["playground",{"children":["__PAGE__",{}]},"$undefined","$undefined",true]}],"$L1",[[],"$L2"]]]]
3:HL["/_next/static/media/86fdec36ddd9097e-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
4:HL["/_next/static/media/c9a5bc6a7c948fb0-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
5:HL["/_next/static/css/6eee720a4f6b5b8e.css","style"]
6:I{"id":81443,"chunks":["272:static/chunks/webpack-0953a0f4ba45aa8f.js","971:static/chunks/fd9d1056-5dfc77aa37d8c76f.js","864:static/chunks/864-bf315a5307aba1d7.js"],"name":"","async":false}
7:I{"id":18639,"chunks":["272:static/chunks/webpack-0953a0f4ba45aa8f.js","971:static/chunks/fd9d1056-5dfc77aa37d8c76f.js","864:static/chunks/864-bf315a5307aba1d7.js"],"name":"","async":false}
8:I{"id":5925,"chunks":["346:static/chunks/346-c4227fa5fd95e485.js","524:static/chunks/524-6309ecb76a77fdcf.js","816:static/chunks/app/playground/layout-fdd575258eb9222e.js"],"name":"Toaster","async":false}
9:I{"id":78495,"chunks":["346:static/chunks/346-c4227fa5fd95e485.js","524:static/chunks/524-6309ecb76a77fdcf.js","816:static/chunks/app/playground/layout-fdd575258eb9222e.js"],"name":"Providers","async":false}
a:I{"id":78963,"chunks":["346:static/chunks/346-c4227fa5fd95e485.js","524:static/chunks/524-6309ecb76a77fdcf.js","816:static/chunks/app/playground/layout-fdd575258eb9222e.js"],"name":"Header","async":false}
c:I{"id":10413,"chunks":["346:static/chunks/346-c4227fa5fd95e485.js","978:static/chunks/978-d4e207ce72da1121.js","524:static/chunks/524-6309ecb76a77fdcf.js","383:static/chunks/app/playground/page-1f3d88d67ef1b88c.js"],"name":"Chat","async":false}
2:[["$","meta","0",{"charSet":"utf-8"}],["$","title","1",{"children":"Tabby Playground"}],["$","meta","2",{"name":"description","content":"Tabby, an opensource, self-hosted AI coding assistant."}],["$","meta","3",{"name":"theme-color","media":"(prefers-color-scheme: light)","content":"white"}],["$","meta","4",{"name":"theme-color","media":"(prefers-color-scheme: dark)","content":"black"}],["$","meta","5",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","6",{"name":"next-size-adjust"}]]
1:["$","$L6",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","template":["$","$L7",null,{}],"templateStyles":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"childProp":{"current":[null,["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{}],["$","body",null,{"className":"font-sans antialiased __variable_e66fe9 __variable_bd9c35","children":[["$","$L8",null,{}],["$","$L9",null,{"attribute":"class","defaultTheme":"system","enableSystem":true,"children":[["$","div",null,{"className":"flex flex-col min-h-screen","children":[["$","$La",null,{}],["$","main",null,{"className":"flex flex-col flex-1 bg-muted/50","children":["$","$L6",null,{"parallelRouterKey":"children","segmentPath":["children","playground","children"],"loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","template":["$","$L7",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","childProp":{"current":["$Lb",["$","$Lc",null,{"id":"s4JyQyq"}],null],"segment":"__PAGE__"},"styles":[]}]}]]}],null]}]]}]]}],null],"segment":"playground"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/6eee720a4f6b5b8e.css","precedence":"next"}]]}]
1:HL["/_next/static/media/86fdec36ddd9097e-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
2:HL["/_next/static/media/c9a5bc6a7c948fb0-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}]
3:HL["/_next/static/css/3aa519e3dd59a9b3.css","style"]
0:["kTf01AW-j0xnBhHfdnMlO",[[["",{"children":["playground",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L4",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/3aa519e3dd59a9b3.css","precedence":"next"}]],"$L5"]]]]
6:I{"id":5925,"chunks":["195:static/chunks/195-42fffaf30b0aaee4.js","861:static/chunks/861-b61dfc288e31f406.js","832:static/chunks/832-06362e8382d18069.js","168:static/chunks/168-628e6130810bc4d7.js","185:static/chunks/app/layout-a3a8312b187162b4.js"],"name":"Toaster","async":false}
7:I{"id":78495,"chunks":["195:static/chunks/195-42fffaf30b0aaee4.js","861:static/chunks/861-b61dfc288e31f406.js","832:static/chunks/832-06362e8382d18069.js","168:static/chunks/168-628e6130810bc4d7.js","185:static/chunks/app/layout-a3a8312b187162b4.js"],"name":"Providers","async":false}
8:I{"id":78963,"chunks":["195:static/chunks/195-42fffaf30b0aaee4.js","861:static/chunks/861-b61dfc288e31f406.js","832:static/chunks/832-06362e8382d18069.js","168:static/chunks/168-628e6130810bc4d7.js","185:static/chunks/app/layout-a3a8312b187162b4.js"],"name":"Header","async":false}
9:I{"id":81443,"chunks":["272:static/chunks/webpack-905b6479559cc2f9.js","971:static/chunks/fd9d1056-5dfc77aa37d8c76f.js","864:static/chunks/864-bf315a5307aba1d7.js"],"name":"","async":false}
a:I{"id":18639,"chunks":["272:static/chunks/webpack-905b6479559cc2f9.js","971:static/chunks/fd9d1056-5dfc77aa37d8c76f.js","864:static/chunks/864-bf315a5307aba1d7.js"],"name":"","async":false}
c:I{"id":10413,"chunks":["195:static/chunks/195-42fffaf30b0aaee4.js","861:static/chunks/861-b61dfc288e31f406.js","978:static/chunks/978-6768c629d09f4ba9.js","168:static/chunks/168-628e6130810bc4d7.js","383:static/chunks/app/playground/page-d13a8c08b4e9e208.js"],"name":"Chat","async":false}
5:[["$","meta","0",{"charSet":"utf-8"}],["$","title","1",{"children":"Tabby - Playground"}],["$","meta","2",{"name":"description","content":"Tabby, an opensource, self-hosted AI coding assistant."}],["$","meta","3",{"name":"theme-color","media":"(prefers-color-scheme: light)","content":"white"}],["$","meta","4",{"name":"theme-color","media":"(prefers-color-scheme: dark)","content":"black"}],["$","meta","5",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","6",{"name":"next-size-adjust"}]]
4:[null,["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[["$","head",null,{}],["$","body",null,{"className":"font-sans antialiased __variable_e66fe9 __variable_bd9c35","children":[["$","$L6",null,{}],["$","$L7",null,{"attribute":"class","defaultTheme":"system","enableSystem":true,"children":[["$","div",null,{"className":"flex flex-col min-h-screen","children":[["$","$L8",null,{}],["$","main",null,{"className":"flex flex-col flex-1 bg-muted/50","children":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","playground","children"],"loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","childProp":{"current":["$Lb",["$","$Lc",null,{"id":"RSr7rXr"}],null],"segment":"__PAGE__"},"styles":[]}],"segment":"playground"},"styles":[]}]}]]}],null]}]]}]]}],null]
b:null

View File

@ -146,13 +146,15 @@ pub async fn main(config: &Config, args: &ServeArgs) {
doc.override_doc(args, &config.swagger);
let app = Router::new()
.route("/", routing::get(playground::handler))
.route("/index.txt", routing::get(playground::handler))
.route("/_next/*path", routing::get(playground::handler))
.merge(api_router(args))
.merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", doc))
.fallback(fallback());
.merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", doc));
let app = if args.chat_model.is_some() {
app.route("/playground", routing::get(playground::handler))
.route("/_next/*path", routing::get(playground::handler))
.route("/playground.txt", routing::get(playground::handler))
} else {
app
};
@ -246,10 +248,6 @@ fn api_router(args: &ServeArgs) -> Router {
.layer(opentelemetry_tracing_layer())
}
fn fallback() -> routing::MethodRouter {
routing::get(|| async { axum::response::Redirect::temporary("/swagger-ui") })
}
fn valid_args(args: &ServeArgs) {
if args.num_replicas_per_device.is_some() {
warn!("--num-replicas-per-device is deprecated and will be removed in future release.");

View File

@ -37,7 +37,9 @@ where
pub async fn handler(uri: Uri) -> impl IntoResponse {
let mut path = uri.path().trim_start_matches('/').to_string();
if path == "playground" {
if path.is_empty() {
path = "index.html".to_owned()
} else if path == "playground" {
path = "playground.html".to_owned();
}
WebStaticFile(path)