diff --git a/README.md b/README.md index 8086a09..93f6e42 100644 --- a/README.md +++ b/README.md @@ -141,5 +141,4 @@ git tag -d v1.0.0; git push origin :refs/tags/v1.0.0; git tag -a v1.0.0 -m "Rele ## To implement -- Better Tailwind CSS classes -- See keycloak user infos +- Token refresh diff --git a/src/app/[locale]/doc/page.tsx b/src/app/[locale]/doc/page.tsx index b852adb..07319d2 100644 --- a/src/app/[locale]/doc/page.tsx +++ b/src/app/[locale]/doc/page.tsx @@ -31,38 +31,213 @@ // ) // } -'use client' +// 'use client'; -import { useEffect, useState } from 'react' -import Spinner from '@/components/spinner' +// import { useEffect, useState } from 'react'; +// import Spinner from '@/components/spinner'; -export default function AboutPage() { - const [data, setData] = useState(null) - const [loading, setLoading] = useState(true) +// export default function AboutPage() { +// const [data, setData] = useState(null); +// const [loading, setLoading] = useState(true); - useEffect(() => { - fetch((process.env.NEXT_PUBLIC_API_URL as string) + '/docs.json') - .then((res) => res.json()) - .then((result) => { - setData(result) - setLoading(false) - }) - .catch(() => { - setLoading(false) - }) - }, []) +// useEffect(() => { +// fetch((process.env.NEXT_PUBLIC_API_URL as string) + '/docs.json') +// .then((res) => res.json()) +// .then((result) => { +// setData(result); +// setLoading(false); +// }) +// .catch(() => { +// setLoading(false); +// }); +// }, []); - if (loading) { - return ( -
-
-
- ) - } +// if (loading) { +// return ( +//
+//
+//
+// ); +// } + +// return ( +//
+// +//
+// ); +// } + +'use client'; + +import Sidebar from '@/components/Sidebar'; +import { SidebarPanel } from '@/components/Sidebar'; +import { + Slider, + NumberInput, + TextInput, + Toggle, +} from '../../../components/Inputs'; + +type PanelProps = { + settings: Settings; + setSettings: React.Dispatch>; +}; + +export type Settings = { + temp: number; + topP: number; + topK: number | undefined; + maxTokens: number | undefined; + numCtx: number | undefined; + stop: string[] | undefined; + repeatPenalty: number; + seed: number | undefined; + stream: boolean; + keepAlive: string | undefined; +}; + +function SettingsPanel({ settings, setSettings }: PanelProps) { + const set = + (key: K) => + (val: Settings[K]) => + setSettings((prev) => ({ ...prev, [key]: val })); + + const sections = [ + { + title: 'Sampling', + fields: (s: any, set: any) => ( + <> + + + + + ), + }, + { + title: 'Generation', + fields: (s: any, set: any) => ( + <> + + + + set('stop')(val ? val.split(',').map((s) => s.trim()) : undefined) + } + placeholder="Comma separated" + /> + + ), + }, + { + title: 'Control', + fields: (s: any, set: any) => ( + <> + + + + ), + }, + { + title: 'System', + fields: (s: any, set: any) => ( + <> + + + + ), + }, + ]; return ( -
- -
- ) -} \ No newline at end of file +
+ {sections.map((section) => ( +
+

+ {section.title} +

+ + {section.fields(settings, set)} +
+ ))} +
+ ); +} + +export const SIDEBAR_PANELS = ({ + settings, + setSettings, +}: PanelProps): SidebarPanel[] => [ + { + id: 'settings', + label: 'Settings', + icon: ( + + + + ), + component: , + }, +]; + +import { useState } from 'react'; + +export default function DocPage() { + const [settings, setSettings] = useState({ + temp: 0.7, + topP: 0.9, + topK: 40, + maxTokens: 1000, + numCtx: 128000, + stop: [''], + repeatPenalty: 1.1, + seed: 0, + stream: true, + keepAlive: '5m', + }); + + return ( +
+ +
+ ); +} diff --git a/src/app/[locale]/layout.tsx b/src/app/[locale]/layout.tsx index 2a20c72..b21d475 100644 --- a/src/app/[locale]/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -40,11 +40,13 @@ export default async function RootLayout(props: { return ( - + -
{props.children}
+
+ {props.children} +