refactor: Rename files to use TypeScript extension

This commit is contained in:
Hichem Fantar 2024-06-17 15:46:52 +01:00
parent 66a65b1510
commit 9ff9696f8d
11 changed files with 329 additions and 185 deletions

View File

@ -1,166 +0,0 @@
// @ts-check
// `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config
import { themes as prismThemes } from "prism-react-renderer";
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Open WebUI",
tagline: "ChatGPT-Style WebUI for LLMs (Formerly Ollama WebUI)",
favicon: "img/favicon.png",
// Set the production url of your site here
url: "https://openwebui.com",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/",
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "open-webui", // Usually your GitHub org/user name.
projectName: "docs", // Usually your repo name.
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
},
// Enable Mermaid for diagrams
markdown: {
mermaid: true,
},
themes: ["@docusaurus/theme-mermaid"],
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: "./sidebars.js",
routeBasePath: "/",
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: "https://github.com/open-webui/docs/blob/main",
},
// blog: false,
blog: {
showReadingTime: true,
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
// editUrl:
// "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
},
theme: {
customCss: "./src/css/custom.css",
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// Replace with your project's social card
// image: "img/docusaurus-social-card.jpg",
navbar: {
title: "Open WebUI",
logo: {
src: "img/logo.png",
srcDark: "img/logo-dark.png",
},
items: [
// {
// type: "docSidebar",
// sidebarId: "blog",
// position: "left",
// label: "Blog",
// },
// {
// href: "/blog",
// label: "Blog",
// position: "left",
// },
{
href: "https://github.com/open-webui/open-webui",
label: "GitHub",
position: "right",
},
],
},
footer: {
logo: {
src: "img/logo-dark.png",
height: 100,
},
style: "light",
links: [
{
title: "Docs",
items: [
{
label: "Getting Started",
to: "getting-started",
},
{
label: "FAQ",
to: "faq",
},
],
},
{
title: "Community",
items: [
{
label: "GitHub",
href: "https://github.com/open-webui/open-webui",
},
{
label: "Discord",
href: "https://discord.gg/5rJgQTnV4s",
},
{
label: "Twitter",
href: "https://twitter.com/OpenWebUI",
},
],
},
{
title: "More",
items: [
{
label: "Release Notes",
to: "https://github.com/open-webui/open-webui/blob/main/CHANGELOG.md",
},
{
label: "About",
to: "https://openwebui.com",
},
{
label: "Research",
to: "research",
},
],
},
],
// copyright: `Copyright © ${new Date().getFullYear()} OpenWebUI`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
}),
plugins: [require.resolve("docusaurus-lunr-search")],
};
export default config;

159
docusaurus.config.ts Normal file
View File

@ -0,0 +1,159 @@
import { Config } from "@docusaurus/types";
import type * as Preset from "@docusaurus/preset-classic";
import { themes as prismThemes } from "prism-react-renderer";
const config: Config = {
title: "Open WebUI",
tagline: "ChatGPT-Style WebUI for LLMs (Formerly Ollama WebUI)",
favicon: "img/favicon.png",
// Set the production url of your site here
url: "https://openwebui.com",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/",
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "open-webui", // Usually your GitHub org/user name.
projectName: "docs", // Usually your repo name.
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
},
// Enable Mermaid for diagrams
markdown: {
mermaid: true,
},
themes: ["@docusaurus/theme-mermaid"],
presets: [
[
"classic",
{
docs: {
sidebarPath: "./sidebars.ts",
routeBasePath: "/",
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: "https://github.com/open-webui/docs/blob/main",
},
// blog: false,
blog: {
showReadingTime: true,
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
// editUrl:
// "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
},
theme: {
customCss: "./src/css/custom.css",
},
} satisfies Preset.Options,
],
],
themeConfig: {
// Replace with your project's social card
// image: "img/docusaurus-social-card.jpg",
navbar: {
title: "Open WebUI",
logo: {
src: "img/logo.png",
srcDark: "img/logo-dark.png",
},
items: [
// {
// type: "docSidebar",
// sidebarId: "blog",
// position: "left",
// label: "Blog",
// },
// {
// href: "/blog",
// label: "Blog",
// position: "left",
// },
{
href: "https://github.com/open-webui/open-webui",
label: "GitHub",
position: "right",
},
],
},
footer: {
logo: {
src: "img/logo-dark.png",
height: 100,
},
style: "light",
links: [
{
title: "Docs",
items: [
{
label: "Getting Started",
to: "getting-started",
},
{
label: "FAQ",
to: "faq",
},
],
},
{
title: "Community",
items: [
{
label: "GitHub",
href: "https://github.com/open-webui/open-webui",
},
{
label: "Discord",
href: "https://discord.gg/5rJgQTnV4s",
},
{
label: "Twitter",
href: "https://twitter.com/OpenWebUI",
},
],
},
{
title: "More",
items: [
{
label: "Release Notes",
to: "https://github.com/open-webui/open-webui/blob/main/CHANGELOG.md",
},
{
label: "About",
to: "https://openwebui.com",
},
{
label: "Research",
to: "research",
},
],
},
],
// copyright: `Copyright © ${new Date().getFullYear()} OpenWebUI`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
} satisfies Preset.ThemeConfig,
plugins: [require.resolve("docusaurus-lunr-search")],
};
export default config;

153
package-lock.json generated
View File

@ -8,22 +8,26 @@
"name": "docs",
"version": "0.0.0",
"dependencies": {
"@docusaurus/core": "^3.4.0",
"@docusaurus/preset-classic": "^3.4.0",
"@docusaurus/theme-mermaid": "^3.4.0",
"@docusaurus/core": "^3.2.0",
"@docusaurus/preset-classic": "^3.2.0",
"@docusaurus/theme-mermaid": "^3.2.0",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.0.0",
"docusaurus-lunr-search": "^3.4.0",
"docusaurus-plugin-sass": "^0.2.5",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
"react-dom": "^18.0.0",
"sass": "^1.77.5"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.2.0",
"@docusaurus/types": "^3.2.0",
"@docusaurus/module-type-aliases": "^3.4.0",
"@docusaurus/tsconfig": "^3.4.0",
"@docusaurus/types": "^3.4.0",
"autoprefixer": "^10.4.19",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3"
"tailwindcss": "^3.4.3",
"typescript": "^5.4.5"
},
"engines": {
"node": ">=18.0"
@ -2643,6 +2647,12 @@
"node": ">=18.0"
}
},
"node_modules/@docusaurus/tsconfig": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/@docusaurus/tsconfig/-/tsconfig-3.4.0.tgz",
"integrity": "sha512-0qENiJ+TRaeTzcg4olrnh0BQ7eCxTgbYWBnWUeQDc84UYkt/T3pDNnm3SiQkqPb+YQ1qtYFlC0RriAElclo8Dg==",
"dev": true
},
"node_modules/@docusaurus/types": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/@docusaurus/types/-/types-3.4.0.tgz",
@ -6360,6 +6370,18 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/docusaurus-plugin-sass": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/docusaurus-plugin-sass/-/docusaurus-plugin-sass-0.2.5.tgz",
"integrity": "sha512-Z+D0fLFUKcFpM+bqSUmqKIU+vO+YF1xoEQh5hoFreg2eMf722+siwXDD+sqtwU8E4MvVpuvsQfaHwODNlxJAEg==",
"dependencies": {
"sass-loader": "^10.1.1"
},
"peerDependencies": {
"@docusaurus/core": "^2.0.0-beta || ^3.0.0-alpha",
"sass": "^1.30.0"
}
},
"node_modules/dom-converter": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz",
@ -8470,6 +8492,11 @@
"url": "https://opencollective.com/immer"
}
},
"node_modules/immutable": {
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.6.tgz",
"integrity": "sha512-Ju0+lEMyzMVZarkTn/gqRpdqd5dOPaz1mCZ0SH3JV6iFw81PldE/PEB1hWVEA288HPt4WXW8O7AWxB10M+03QQ=="
},
"node_modules/import-fresh": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
@ -9074,6 +9101,14 @@
"node": ">=6"
}
},
"node_modules/klona": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/klona/-/klona-2.0.6.tgz",
"integrity": "sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA==",
"engines": {
"node": ">= 8"
}
},
"node_modules/latest-version": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/latest-version/-/latest-version-7.0.0.tgz",
@ -14555,6 +14590,103 @@
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/sass": {
"version": "1.77.5",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.77.5.tgz",
"integrity": "sha512-oDfX1mukIlxacPdQqNb6mV2tVCrnE+P3nVYioy72V5tlk56CPNcO4TCuFcaCRKKfJ1M3lH95CleRS+dVKL2qMg==",
"dependencies": {
"chokidar": ">=3.0.0 <4.0.0",
"immutable": "^4.0.0",
"source-map-js": ">=0.6.2 <2.0.0"
},
"bin": {
"sass": "sass.js"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/sass-loader": {
"version": "10.5.2",
"resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-10.5.2.tgz",
"integrity": "sha512-vMUoSNOUKJILHpcNCCyD23X34gve1TS7Rjd9uXHeKqhvBG39x6XbswFDtpbTElj6XdMFezoWhkh5vtKudf2cgQ==",
"dependencies": {
"klona": "^2.0.4",
"loader-utils": "^2.0.0",
"neo-async": "^2.6.2",
"schema-utils": "^3.0.0",
"semver": "^7.3.2"
},
"engines": {
"node": ">= 10.13.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
},
"peerDependencies": {
"fibers": ">= 3.1.0",
"node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",
"sass": "^1.3.0",
"webpack": "^4.36.0 || ^5.0.0"
},
"peerDependenciesMeta": {
"fibers": {
"optional": true
},
"node-sass": {
"optional": true
},
"sass": {
"optional": true
}
}
},
"node_modules/sass-loader/node_modules/ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dependencies": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/sass-loader/node_modules/ajv-keywords": {
"version": "3.5.2",
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
"peerDependencies": {
"ajv": "^6.9.1"
}
},
"node_modules/sass-loader/node_modules/json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
},
"node_modules/sass-loader/node_modules/schema-utils": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz",
"integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==",
"dependencies": {
"@types/json-schema": "^7.0.8",
"ajv": "^6.12.5",
"ajv-keywords": "^3.5.2"
},
"engines": {
"node": ">= 10.13.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
}
},
"node_modules/sax": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz",
@ -15831,10 +15963,9 @@
}
},
"node_modules/typescript": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz",
"integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==",
"peer": true,
"version": "5.4.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"

View File

@ -22,16 +22,20 @@
"@mdx-js/react": "^3.0.0",
"clsx": "^2.0.0",
"docusaurus-lunr-search": "^3.4.0",
"docusaurus-plugin-sass": "^0.2.5",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
"react-dom": "^18.0.0",
"sass": "^1.77.5"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.2.0",
"@docusaurus/types": "^3.2.0",
"@docusaurus/module-type-aliases": "^3.4.0",
"@docusaurus/tsconfig": "^3.4.0",
"@docusaurus/types": "^3.4.0",
"autoprefixer": "^10.4.19",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3"
"tailwindcss": "^3.4.3",
"typescript": "^5.4.5"
},
"browserslist": {
"production": [

View File

@ -9,10 +9,9 @@
Create as many sidebars as you want.
*/
// @ts-check
import type { SidebarsConfig } from "@docusaurus/plugin-content-docs";
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
const sidebars: SidebarsConfig = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{ type: "autogenerated", dirName: "." }],

View File

@ -8,7 +8,7 @@ export const Sponsor = ({ sponsor }) => {
</a>
</div>
<a a href={sponsor.url} target="_blank">
<a href={sponsor.url} target="_blank">
<div className="flex w-32 md:w-48 gap-2.5 items-start">
<div className=" basis-1/2">
<img

17
tsconfig.json Normal file
View File

@ -0,0 +1,17 @@
// https://docusaurus.io/docs/typescript-support
// This file is not used in compilation. It is here just for a nice editor experience.
{
"extends": "@docusaurus/tsconfig",
"compilerOptions": {
"baseUrl": ".",
// https://miyoon.medium.com/array-parameters-in-tsconfig-json-are-always-overwritten-11c80bb514e1
// https://github.com/microsoft/TypeScript/issues/20110
"types": [
"node",
"@docusaurus/module-type-aliases",
"@docusaurus/theme-classic",
"docusaurus-plugin-sass"
]
},
"exclude": ["node_modules", "build", ".docusaurus"]
}