From 2fd0276e4c84a3684e551b4374e70c9236fb4a01 Mon Sep 17 00:00:00 2001 From: Montana Low Date: Wed, 13 Sep 2023 16:28:10 -0700 Subject: [PATCH 1/2] gitbook assets --- README.md | 13 +- pgml-dashboard/.env.development | 1 + pgml-dashboard/Cargo.lock | 27 + pgml-dashboard/Cargo.toml | 3 + pgml-dashboard/README.md | 2 +- .../content/docs/guides/dashboard/overview.md | 2 +- .../docs/guides/setup/distributed_training.md | 2 +- .../docs/guides/setup/v2/installation.md | 2 +- pgml-dashboard/src/api/docs.rs | 85 ++- .../src/components/navbar/template.html | 2 +- .../components/navbar_web_app/template.html | 4 +- pgml-dashboard/src/main.rs | 2 +- pgml-dashboard/src/templates/docs.rs | 6 +- pgml-dashboard/src/utils/config.rs | 9 +- pgml-dashboard/src/utils/markdown.rs | 269 +++++++++- .../templates/content/not_found.html | 2 +- pgml-dashboard/templates/layout/footer.html | 2 +- pgml-dashboard/templates/layout/nav/top.html | 2 +- .../templates/layout/nav/top_web_app.html | 4 +- .../assets/1M-RPS-batching-latency (1).png | Bin 42831 -> 0 bytes .../assets/1M-RPS-batching-latency.png | Bin 42831 -> 0 bytes .../assets/1M-RPS-batching-throughput (1).png | Bin 57192 -> 0 bytes .../assets/1M-RPS-batching-throughput.png | Bin 57192 -> 0 bytes .../.gitbook/assets/1M-RPS-latency (1).png | Bin 52884 -> 0 bytes pgml-docs/.gitbook/assets/1M-RPS-latency.png | Bin 52884 -> 0 bytes .../.gitbook/assets/1M-RPS-throughput (1).png | Bin 55334 -> 0 bytes .../.gitbook/assets/1M-RPS-throughput.png | Bin 55334 -> 0 bytes .../assets/8-40x-latency-realworld.png | Bin 59713 -> 0 bytes .../assets/8-40x-latency-ultrajson.png | Bin 64484 -> 0 bytes pgml-docs/.gitbook/assets/8-40x-latency.png | Bin 55447 -> 0 bytes .../8-40x-memory-utilization-training.png | Bin 57623 -> 0 bytes .../assets/8-40x-memory-utilization.png | Bin 54539 -> 0 bytes .../assets/8-40x-throughput-realworld.png | Bin 70597 -> 0 bytes .../assets/8-40x-throughput-ultrajson.png | Bin 72429 -> 0 bytes .../.gitbook/assets/8-40x-throughput.png | Bin 63367 -> 0 bytes .../.gitbook/assets/database_connectivity.png | Bin 442140 -> 0 bytes .../.gitbook/assets/mindsdb-architecture.png | Bin 148387 -> 0 bytes .../assets/mindsdb-pgml-architecture.png | Bin 148387 -> 0 bytes .../assets/pgcat_cache_hits_misses.webp | Bin 130298 -> 0 bytes .../assets/pgcat_prepared_throughput.svg | 1 - .../assets/postgres-multiprocess-2.png | Bin 169974 -> 0 bytes pgml-docs/.gitbook/assets/queueing.svg | 4 - .../.gitbook/assets/scaling-postgresml-3.svg | 4 - pgml-docs/.gitbook/assets/select_plan.png | Bin 1902774 -> 0 bytes .../.gitbook/assets/signup_screenshot.png | Bin 193161 -> 0 bytes pgml-docs/README.md | 17 - pgml-docs/SUMMARY.md | 67 --- pgml-docs/apps/README.md | 3 - pgml-docs/apps/chatbots.md | 162 ------ pgml-docs/apps/fraud-detection.md | 3 - pgml-docs/apps/recommendation-engine.md | 3 - pgml-docs/apps/search.md | 3 - pgml-docs/apps/time-series-forecasting.md | 2 - pgml-docs/benchmarks/README.md | 2 - ...lm-support-for-huggingface-transformers.md | 434 --------------- ...ostgres-30-percent-faster-in-production.md | 48 -- .../benchmarks/million-requests-per-second.md | 238 --------- pgml-docs/benchmarks/mindsdb-vs-postgresml.md | 299 ----------- ...x-faster-than-python-http-microservices.md | 191 ------- pgml-docs/developer-docs/README.md | 2 - pgml-docs/developer-docs/contributing.md | 236 -------- .../developer-docs/distributed-training.md | 172 ------ pgml-docs/developer-docs/gpu-support.md | 62 --- pgml-docs/developer-docs/installation.md | 374 ------------- .../developer-docs/quick-start-with-docker.md | 280 ---------- .../docs/guides/getting-started/sign-up.md | 1 - .../data-pre-processing.md | 6 +- pgml-docs/faqs.md | 40 -- pgml-docs/getting-started/README.md | 3 - .../connect-to-the-database.md | 36 -- .../getting-started/database-credentials.md | 5 - pgml-docs/getting-started/select-a-plan.md | 5 - pgml-docs/getting-started/sign-up.md | 11 - pgml-docs/machine-learning/README.md | 2 - .../natural-language-processing/README.md | 8 - .../natural-language-processing/embeddings.md | 25 - .../natural-language-processing/fill-mask.md | 30 -- .../question-answering.md | 30 -- .../summarization.md | 50 -- .../text-classification.md | 190 ------- .../text-generation.md | 190 ------- .../text-to-text-generation.md | 40 -- .../token-classification.md | 60 --- .../translation.md | 26 - .../zero-shot-classification.md | 38 -- .../supervised-learning/README.md | 317 ----------- .../supervised-learning/classification.md | 53 -- .../data-pre-processing.md | 156 ------ .../hyperparameter-search.md | 75 --- .../supervised-learning/joint-optimization.md | 18 - .../supervised-learning/regression.md | 64 --- .../machine-learning/unsupervised-learning.md | 66 --- pgml-docs/monitoring.md | 2 - pgml-docs/overview.md | 17 - pgml-docs/pgcat.md | 252 --------- pgml-docs/sdks/README.md | 3 - pgml-docs/sdks/collections.md | 89 --- pgml-docs/sdks/getting-started.md | 229 -------- pgml-docs/sdks/overview.md | 25 - pgml-docs/sdks/pipelines.md | 257 --------- pgml-docs/sdks/search.md | 271 ---------- pgml-docs/sdks/tutorials/README.md | 2 - .../extractive-question-answering.md | 145 ----- .../semantic-search-using-instructor-model.md | 115 ---- pgml-docs/sdks/tutorials/semantic-search.md | 176 ------ .../summarizing-question-answering.md | 146 ----- pgml-docs/test.md | 6 + pgml-docs/use-cases/README.md | 2 - ...s-with-open-source-models-in-postgresml.md | 350 ------------ ...ve-search-results-with-machine-learning.md | 456 ---------------- ...with-postgresml-and-dbt-data-build-tool.md | 192 ------- ...-with-application-data-in-your-database.md | 300 ----------- ...rating-query-embeddings-in-the-database.md | 505 ------------------ pgml-docs/vector-database.md | 84 --- 114 files changed, 354 insertions(+), 7861 deletions(-) delete mode 100644 pgml-docs/.gitbook/assets/1M-RPS-batching-latency (1).png delete mode 100644 pgml-docs/.gitbook/assets/1M-RPS-batching-latency.png delete mode 100644 pgml-docs/.gitbook/assets/1M-RPS-batching-throughput (1).png delete mode 100644 pgml-docs/.gitbook/assets/1M-RPS-batching-throughput.png delete mode 100644 pgml-docs/.gitbook/assets/1M-RPS-latency (1).png delete mode 100644 pgml-docs/.gitbook/assets/1M-RPS-latency.png delete mode 100644 pgml-docs/.gitbook/assets/1M-RPS-throughput (1).png delete mode 100644 pgml-docs/.gitbook/assets/1M-RPS-throughput.png delete mode 100644 pgml-docs/.gitbook/assets/8-40x-latency-realworld.png delete mode 100644 pgml-docs/.gitbook/assets/8-40x-latency-ultrajson.png delete mode 100644 pgml-docs/.gitbook/assets/8-40x-latency.png delete mode 100644 pgml-docs/.gitbook/assets/8-40x-memory-utilization-training.png delete mode 100644 pgml-docs/.gitbook/assets/8-40x-memory-utilization.png delete mode 100644 pgml-docs/.gitbook/assets/8-40x-throughput-realworld.png delete mode 100644 pgml-docs/.gitbook/assets/8-40x-throughput-ultrajson.png delete mode 100644 pgml-docs/.gitbook/assets/8-40x-throughput.png delete mode 100644 pgml-docs/.gitbook/assets/database_connectivity.png delete mode 100644 pgml-docs/.gitbook/assets/mindsdb-architecture.png delete mode 100644 pgml-docs/.gitbook/assets/mindsdb-pgml-architecture.png delete mode 100644 pgml-docs/.gitbook/assets/pgcat_cache_hits_misses.webp delete mode 100644 pgml-docs/.gitbook/assets/pgcat_prepared_throughput.svg delete mode 100644 pgml-docs/.gitbook/assets/postgres-multiprocess-2.png delete mode 100644 pgml-docs/.gitbook/assets/queueing.svg delete mode 100644 pgml-docs/.gitbook/assets/scaling-postgresml-3.svg delete mode 100644 pgml-docs/.gitbook/assets/select_plan.png delete mode 100644 pgml-docs/.gitbook/assets/signup_screenshot.png delete mode 100644 pgml-docs/README.md delete mode 100644 pgml-docs/SUMMARY.md delete mode 100644 pgml-docs/apps/README.md delete mode 100644 pgml-docs/apps/chatbots.md delete mode 100644 pgml-docs/apps/fraud-detection.md delete mode 100644 pgml-docs/apps/recommendation-engine.md delete mode 100644 pgml-docs/apps/search.md delete mode 100644 pgml-docs/apps/time-series-forecasting.md delete mode 100644 pgml-docs/benchmarks/README.md delete mode 100644 pgml-docs/benchmarks/ggml-quantized-llm-support-for-huggingface-transformers.md delete mode 100644 pgml-docs/benchmarks/making-postgres-30-percent-faster-in-production.md delete mode 100644 pgml-docs/benchmarks/million-requests-per-second.md delete mode 100644 pgml-docs/benchmarks/mindsdb-vs-postgresml.md delete mode 100644 pgml-docs/benchmarks/postgresml-is-8-40x-faster-than-python-http-microservices.md delete mode 100644 pgml-docs/developer-docs/README.md delete mode 100644 pgml-docs/developer-docs/contributing.md delete mode 100644 pgml-docs/developer-docs/distributed-training.md delete mode 100644 pgml-docs/developer-docs/gpu-support.md delete mode 100644 pgml-docs/developer-docs/installation.md delete mode 100644 pgml-docs/developer-docs/quick-start-with-docker.md delete mode 100644 pgml-docs/faqs.md delete mode 100644 pgml-docs/getting-started/README.md delete mode 100644 pgml-docs/getting-started/connect-to-the-database.md delete mode 100644 pgml-docs/getting-started/database-credentials.md delete mode 100644 pgml-docs/getting-started/select-a-plan.md delete mode 100644 pgml-docs/getting-started/sign-up.md delete mode 100644 pgml-docs/machine-learning/README.md delete mode 100644 pgml-docs/machine-learning/natural-language-processing/README.md delete mode 100644 pgml-docs/machine-learning/natural-language-processing/embeddings.md delete mode 100644 pgml-docs/machine-learning/natural-language-processing/fill-mask.md delete mode 100644 pgml-docs/machine-learning/natural-language-processing/question-answering.md delete mode 100644 pgml-docs/machine-learning/natural-language-processing/summarization.md delete mode 100644 pgml-docs/machine-learning/natural-language-processing/text-classification.md delete mode 100644 pgml-docs/machine-learning/natural-language-processing/text-generation.md delete mode 100644 pgml-docs/machine-learning/natural-language-processing/text-to-text-generation.md delete mode 100644 pgml-docs/machine-learning/natural-language-processing/token-classification.md delete mode 100644 pgml-docs/machine-learning/natural-language-processing/translation.md delete mode 100644 pgml-docs/machine-learning/natural-language-processing/zero-shot-classification.md delete mode 100644 pgml-docs/machine-learning/supervised-learning/README.md delete mode 100644 pgml-docs/machine-learning/supervised-learning/classification.md delete mode 100644 pgml-docs/machine-learning/supervised-learning/data-pre-processing.md delete mode 100644 pgml-docs/machine-learning/supervised-learning/hyperparameter-search.md delete mode 100644 pgml-docs/machine-learning/supervised-learning/joint-optimization.md delete mode 100644 pgml-docs/machine-learning/supervised-learning/regression.md delete mode 100644 pgml-docs/machine-learning/unsupervised-learning.md delete mode 100644 pgml-docs/monitoring.md delete mode 100644 pgml-docs/overview.md delete mode 100644 pgml-docs/pgcat.md delete mode 100644 pgml-docs/sdks/README.md delete mode 100644 pgml-docs/sdks/collections.md delete mode 100644 pgml-docs/sdks/getting-started.md delete mode 100644 pgml-docs/sdks/overview.md delete mode 100644 pgml-docs/sdks/pipelines.md delete mode 100644 pgml-docs/sdks/search.md delete mode 100644 pgml-docs/sdks/tutorials/README.md delete mode 100644 pgml-docs/sdks/tutorials/extractive-question-answering.md delete mode 100644 pgml-docs/sdks/tutorials/semantic-search-using-instructor-model.md delete mode 100644 pgml-docs/sdks/tutorials/semantic-search.md delete mode 100644 pgml-docs/sdks/tutorials/summarizing-question-answering.md create mode 100644 pgml-docs/test.md delete mode 100644 pgml-docs/use-cases/README.md delete mode 100644 pgml-docs/use-cases/generating-llm-embeddings-with-open-source-models-in-postgresml.md delete mode 100644 pgml-docs/use-cases/improve-search-results-with-machine-learning.md delete mode 100644 pgml-docs/use-cases/llm-based-pipelines-with-postgresml-and-dbt-data-build-tool.md delete mode 100644 pgml-docs/use-cases/personalize-embedding-results-with-application-data-in-your-database.md delete mode 100644 pgml-docs/use-cases/tuning-vector-recall-while-generating-query-embeddings-in-the-database.md delete mode 100644 pgml-docs/vector-database.md diff --git a/README.md b/README.md index aa585e2d0..3a34cb672 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,10 @@ SELECT pgml.predict( # Installation PostgresML installation consists of three parts: PostgreSQL database, Postgres extension for machine learning and a dashboard app. The extension provides all the machine learning functionality and can be used independently using any SQL IDE. The dashboard app provides an easy to use interface for writing SQL notebooks, performing and tracking ML experiments and ML models. +## Serverless Cloud + +If you want to check out the functionality without the hassle of Docker, [sign up for a free PostgresML account](https://postgresml.org/signup). You'll get a free database in seconds, with access to GPUs and state of the art LLMs. + ## Docker ``` @@ -150,19 +154,14 @@ docker run \ sudo -u postgresml psql -d postgresml ``` -For more details, take a look at our [Quick Start with Docker](https://postgresml.org/docs/guides/setup/quick_start_with_docker) documentation. - -## Serverless Cloud - -If you want to check out the functionality without the hassle of Docker, [sign up for a free PostgresML account](https://postgresml.org/signup). You'll get a free database in seconds, with access to GPUs and state of the art LLMs. +For more details, take a look at our [Quick Start with Docker](https://postgresml.org/docs/guides/developer-docs/quick-start-with-docker) documentation. # Getting Started ## Option 1 -- On local installation, go to dashboard app at `http://localhost:8000/` to use SQL notebooks. - - On the cloud console click on the **Dashboard** button to connect to your instance with a SQL notebook, or connect directly with tools listed below. +- On local installation, go to dashboard app at `http://localhost:8000/` to use SQL notebooks. ## Option 2 diff --git a/pgml-dashboard/.env.development b/pgml-dashboard/.env.development index 6129ccd80..81bf7e34a 100644 --- a/pgml-dashboard/.env.development +++ b/pgml-dashboard/.env.development @@ -1,2 +1,3 @@ DATABASE_URL=postgres:///pgml_dashboard_development DEV_MODE=true +RUST_LOG=debug,tantivy=error,rocket=info diff --git a/pgml-dashboard/Cargo.lock b/pgml-dashboard/Cargo.lock index ba9a3c5ef..0298a5519 100644 --- a/pgml-dashboard/Cargo.lock +++ b/pgml-dashboard/Cargo.lock @@ -559,6 +559,15 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "cookie" version = "0.17.0" @@ -1741,6 +1750,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" +[[package]] +name = "markdown" +version = "1.0.0-alpha.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e9ce98969bb1391c8d6fdac320897ea7e86c4d356e8f220a5abd28b142e512" +dependencies = [ + "unicode-id", +] + [[package]] name = "markup5ever" version = "0.11.0" @@ -2186,6 +2204,7 @@ dependencies = [ "chrono", "comrak", "console-subscriber", + "convert_case", "csv-async", "dotenv", "env_logger", @@ -2193,6 +2212,7 @@ dependencies = [ "itertools", "lazy_static", "log", + "markdown", "num-traits", "once_cell", "parking_lot 0.12.1", @@ -2212,6 +2232,7 @@ dependencies = [ "tantivy", "time 0.3.23", "tokio", + "url", "yaml-rust", "zoomies", ] @@ -4083,6 +4104,12 @@ version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +[[package]] +name = "unicode-id" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1b6def86329695390197b82c1e244a54a131ceb66c996f2088a3876e2ae083f" + [[package]] name = "unicode-ident" version = "1.0.11" diff --git a/pgml-dashboard/Cargo.toml b/pgml-dashboard/Cargo.toml index 3313a16ff..172b49ddd 100644 --- a/pgml-dashboard/Cargo.toml +++ b/pgml-dashboard/Cargo.toml @@ -17,12 +17,14 @@ base64 = "0.21" comrak = "0.17" chrono = "0.4" csv-async = "1" +convert_case = "0.6" dotenv = "0.15" env_logger = "0.10" itertools = "0.10" parking_lot = "0.12" lazy_static = "1.4" log = "0.4" +markdown = "1.0.0-alpha.13" num-traits = "0.2" once_cell = "1.18" rand = "0.8" @@ -39,6 +41,7 @@ sqlx = { version = "0.6.3", features = [ "runtime-tokio-rustls", "postgres", "js tantivy = "0.19" time = "0.3" tokio = { version = "1", features = ["full"] } +url = "2.4" yaml-rust = "0.4" zoomies = { git="https://github.com/HyperparamAI/zoomies.git", branch="master" } pgvector = { version = "0.2.2", features = [ "sqlx", "postgres" ] } diff --git a/pgml-dashboard/README.md b/pgml-dashboard/README.md index a960ad77a..91cfdec00 100644 --- a/pgml-dashboard/README.md +++ b/pgml-dashboard/README.md @@ -2,4 +2,4 @@ PostgresML provides a dashboard with analytical views of the training data and model performance, as well as integrated notebooks for rapid iteration. It is primarily written in Rust using [Rocket](https://rocket.rs/) as a lightweight web framework and [SQLx](https://github.com/launchbadge/sqlx) to interact with the database. -Please see the [quick start instructions](https://postgresml.org/user_guides/setup/quick_start_with_docker/) for general information on installing or deploying PostgresML. A [developer guide](https://postgresml.org/developer_guide/overview/) is also available for those who would like to contribute. +Please see the [quick start instructions](https://postgresml.org/docs/guides/getting-started/sign-up) for general information on installing or deploying PostgresML. A [developer guide](https://postgresml.org/developer_guide/overview/) is also available for those who would like to contribute. diff --git a/pgml-dashboard/content/docs/guides/dashboard/overview.md b/pgml-dashboard/content/docs/guides/dashboard/overview.md index 4f0e16f43..70eb761f6 100644 --- a/pgml-dashboard/content/docs/guides/dashboard/overview.md +++ b/pgml-dashboard/content/docs/guides/dashboard/overview.md @@ -1,6 +1,6 @@ # Dashboard -PostgresML comes with a web app to provide visibility into models and datasets in your database. If you're running [our Docker container](/docs/guides/setup/quick_start_with_docker/), you can view it running on [http://localhost:8000/](http://localhost:8000/). +PostgresML comes with a web app to provide visibility into models and datasets in your database. If you're running [our Docker container](/docs/guides/developer-docs/quick-start-with-docker), you can view it running on [http://localhost:8000/](http://localhost:8000/). ## Generate example data diff --git a/pgml-dashboard/content/docs/guides/setup/distributed_training.md b/pgml-dashboard/content/docs/guides/setup/distributed_training.md index 41ff97e4f..748595f3c 100644 --- a/pgml-dashboard/content/docs/guides/setup/distributed_training.md +++ b/pgml-dashboard/content/docs/guides/setup/distributed_training.md @@ -22,7 +22,7 @@ psql \ -f dump.sql ``` -If you're using our Docker stack, you can import the data there:

+If you're using our Docker stack, you can import the data there:

``` psql \ diff --git a/pgml-dashboard/content/docs/guides/setup/v2/installation.md b/pgml-dashboard/content/docs/guides/setup/v2/installation.md index 683ad7302..3dd865f33 100644 --- a/pgml-dashboard/content/docs/guides/setup/v2/installation.md +++ b/pgml-dashboard/content/docs/guides/setup/v2/installation.md @@ -10,7 +10,7 @@ The extension can be installed by compiling it from source, or if you're using U !!! tip -If you're just looking to try PostgresML without installing it on your system, take a look at our [Quick Start with Docker](/docs/guides/setup/quick_start_with_docker) guide. +If you're just looking to try PostgresML without installing it on your system, take a look at our [Quick Start with Docker](/docs/guides/developer-docs/quick-start-with-docker) guide. !!! diff --git a/pgml-dashboard/src/api/docs.rs b/pgml-dashboard/src/api/docs.rs index bfabb78e3..10fc5d948 100644 --- a/pgml-dashboard/src/api/docs.rs +++ b/pgml-dashboard/src/api/docs.rs @@ -24,54 +24,36 @@ async fn search(query: &str, index: &State) -> ResponseOk ) } -#[get("/docs/", rank = 10)] -async fn doc_handler<'a>(path: PathBuf, cluster: &Cluster) -> Result { - let guides = vec![ - NavLink::new("Setup").children(vec![ - NavLink::new("Installation").children(vec![ - NavLink::new("v2").href("/docs/guides/setup/v2/installation"), - NavLink::new("Upgrade from v1.0 to v2.0") - .href("/docs/guides/setup/v2/upgrade-from-v1"), - NavLink::new("v1").href("/docs/guides/setup/installation"), - ]), - NavLink::new("Quick Start with Docker") - .href("/docs/guides/setup/quick_start_with_docker"), - NavLink::new("Distributed Training").href("/docs/guides/setup/distributed_training"), - NavLink::new("GPU Support").href("/docs/guides/setup/gpu_support"), - NavLink::new("Developer Setup").href("/docs/guides/setup/developers"), - ]), - NavLink::new("Training").children(vec![ - NavLink::new("Overview").href("/docs/guides/training/overview"), - NavLink::new("Algorithm Selection").href("/docs/guides/training/algorithm_selection"), - NavLink::new("Hyperparameter Search") - .href("/docs/guides/training/hyperparameter_search"), - NavLink::new("Preprocessing Data").href("/docs/guides/training/preprocessing"), - NavLink::new("Joint Optimization").href("/docs/guides/training/joint_optimization"), - ]), - NavLink::new("Predictions").children(vec![ - NavLink::new("Overview").href("/docs/guides/predictions/overview"), - NavLink::new("Deployments").href("/docs/guides/predictions/deployments"), - NavLink::new("Batch Predictions").href("/docs/guides/predictions/batch"), - ]), - NavLink::new("Transformers").children(vec![ - NavLink::new("Setup").href("/docs/guides/transformers/setup"), - NavLink::new("Pre-trained Models").href("/docs/guides/transformers/pre_trained_models"), - NavLink::new("Fine Tuning").href("/docs/guides/transformers/fine_tuning"), - NavLink::new("Embeddings").href("/docs/guides/transformers/embeddings"), - ]), - NavLink::new("Vector Operations").children(vec![ - NavLink::new("Overview").href("/docs/guides/vector_operations/overview") - ]), - NavLink::new("Dashboard").href("/docs/guides/dashboard/overview"), - NavLink::new("Schema").children(vec![ - NavLink::new("Models").href("/docs/guides/schema/models"), - NavLink::new("Snapshots").href("/docs/guides/schema/snapshots"), - NavLink::new("Projects").href("/docs/guides/schema/projects"), - NavLink::new("Deployments").href("/docs/guides/schema/deployments"), - ]), - ]; - - render(cluster, &path, guides, "Guides", &Path::new("docs")).await +use rocket::fs::NamedFile; + +#[get("/docs/guides/.gitbook/assets/", rank = 10)] +pub async fn gitbook_assets(path: PathBuf) -> Option { + let path = PathBuf::from(&config::docs_dir()) + .join("docs/guides/.gitbook/assets/") + .join(path); + + NamedFile::open(path).await.ok() +} + +#[get("/docs/", rank = 5)] +async fn doc_handler(path: PathBuf, cluster: &Cluster) -> Result { + let root = PathBuf::from("docs/guides/"); + let index_path = PathBuf::from(&config::docs_dir()) + .join(&root) + .join("SUMMARY.md"); + let contents = tokio::fs::read_to_string(&index_path).await.expect( + format!( + "could not read table of contents markdown: {:?}", + index_path + ) + .as_str(), + ); + let mdast = ::markdown::to_mdast(&contents, &::markdown::ParseOptions::default()) + .expect("could not parse table of contents markdown"); + let guides = markdown::parse_summary_into_nav_links(&mdast) + .expect("could not extract nav links from table of contents"); + + render(cluster, &path, guides, "Guides", &Path::new("docs"), &config::docs_dir()).await } #[get("/blog/", rank = 10)] @@ -134,6 +116,7 @@ async fn blog_handler<'a>(path: PathBuf, cluster: &Cluster) -> Result( mut nav_links: Vec, nav_title: &'a str, folder: &'a Path, + content: &'a str, ) -> Result { let url = path.clone(); // Get the document content - let path = Path::new(&config::content_dir()) + let path = Path::new(&content) .join(folder) .join(&(path.to_str().unwrap().to_string() + ".md")); + info!("path: {:?}", path); // Read to string let contents = match tokio::fs::read_to_string(&path).await { Ok(contents) => contents, @@ -244,7 +229,7 @@ async fn render<'a>( } pub fn routes() -> Vec { - routes![doc_handler, blog_handler, search] + routes![gitbook_assets, doc_handler, blog_handler, search] } #[cfg(test)] diff --git a/pgml-dashboard/src/components/navbar/template.html b/pgml-dashboard/src/components/navbar/template.html index 7f54386ae..f000aa67f 100644 --- a/pgml-dashboard/src/components/navbar/template.html +++ b/pgml-dashboard/src/components/navbar/template.html @@ -15,7 +15,7 @@