🌐 AI搜索 & 代理 主页
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion pgml-dashboard/src/api/cms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::{
path::{Path, PathBuf},
};

use rocket::response::Redirect;
use std::str::FromStr;

use comrak::{format_html_with_plugins, parse_document, Arena, ComrakPlugins};
Expand Down Expand Up @@ -62,7 +63,10 @@ lazy_static! {
("transformers/fine_tuning/", "api/sql-extension/pgml.tune"),
("guides/predictions/overview", "api/sql-extension/pgml.predict/"),
("machine-learning/supervised-learning/data-pre-processing", "api/sql-extension/pgml.train/data-pre-processing"),
("api/client-sdk/getting-started", "api/client-sdk/"),
("introduction/getting-started/import-your-data/", "introduction/import-your-data/"),
("introduction/getting-started/import-your-data/foreign-data-wrapper", "introduction/import-your-data/foreign-data-wrappers"),
("use-cases/embeddings/generating-llm-embeddings-with-open-source-models-in-postgresml", "open-source/pgml/guides/embeddings/in-database-generation"),
("use-cases/natural-language-processing", "open-source/pgml/guides/natural-language-processing"),
])
);
}
Expand Down Expand Up @@ -857,6 +861,50 @@ pub async fn careers_apply(title: PathBuf, cluster: &Cluster) -> Result<Response
Ok(ResponseOk(layout.render(page)))
}

/// Redirect api to open-source
#[get("/docs/api/<path..>")]
pub async fn api_redirect(path: PathBuf) -> Redirect {
match path.to_str().unwrap() {
"apis" => Redirect::permanent("/docs/open-source/korvus/"),
"client-sdk/search" => {
Redirect::permanent("/docs/open-source/korvus/guides/document-search")
}
"client-sdk/getting-started" => Redirect::permanent("/docs/open-source/korvus/"),
"sql-extensions/pgml.predict/" => Redirect::permanent("/docs/open-source/pgml/api/pgml.predict/"),
"sql-extensions/pgml.deploy" => Redirect::permanent("/docs/open-source/pgml/api/pgml.deploy"),
_ => Redirect::permanent("/docs/open-source/".to_owned() + path.to_str().unwrap()),
}
}

/// Redirect our old sql-extension path.
#[get("/docs/open-source/sql-extension/<path..>")]
pub async fn sql_extension_redirect(path: PathBuf) -> Redirect {
Redirect::permanent("/docs/open-source/pgml/api/".to_owned() + path.to_str().unwrap())
}

/// Redirect our old pgcat path.
#[get("/docs/product/pgcat/<path..>")]
pub async fn pgcat_redirect(path: PathBuf) -> Redirect {
Redirect::permanent("/docs/open-source/pgcat/".to_owned() + path.to_str().unwrap())
}

/// Redirect our old cloud-database path.
#[get("/docs/product/cloud-database/<path..>")]
pub async fn cloud_database_redirect(path: PathBuf) -> Redirect {
let path = path.to_str().unwrap();
if path.is_empty() {
Redirect::permanent("/docs/cloud/overview")
} else {
Redirect::permanent("/docs/cloud/".to_owned() + path)
}
}

/// Redirect our old pgml docs.
#[get("/docs/open-source/client-sdk/<path..>")]
pub async fn pgml_redirect(path: PathBuf) -> Redirect {
Redirect::permanent("/docs/open-source/korvus/api/".to_owned() + path.to_str().unwrap())
}

#[get("/docs/<path..>", rank = 5)]
async fn get_docs(
path: PathBuf,
Expand Down Expand Up @@ -936,6 +984,7 @@ async fn docs_landing_page(cluster: &Cluster) -> Result<ResponseOk, crate::respo
Ok(ResponseOk(doc_layout.render(page)))
}

/// Redirect our old MkDocs paths to the new ones under `/docs`.
#[get("/user_guides/<path..>", rank = 5)]
async fn get_user_guides(path: PathBuf) -> Result<Response, crate::responses::NotFound> {
Ok(Response::redirect(format!("/docs/{}", path.display().to_string())))
Expand Down Expand Up @@ -1003,6 +1052,11 @@ pub fn routes() -> Vec<Route> {
search,
search_blog,
demo,
sql_extension_redirect,
api_redirect,
pgcat_redirect,
pgml_redirect,
cloud_database_redirect
]
}

Expand Down
4 changes: 4 additions & 0 deletions pgml-dashboard/src/components/cms/index_link/index_link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ div[data-controller="cms-index-link"] {
text-decoration: underline;
text-underline-offset: 2px;
}

.material-symbols-outlined {
user-select: none;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ div[data-controller="navigation-left-nav-docs"] {
box-sizing: border-box;
width: 100%;
}

.doc-leftnav-inner {
width: 100%;
}

.show-scroll {
padding-right: 25px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"guides" => "menu_book",
"resources" => "school",
"introduction" => "list_alt",
"cloud" => "cloud",
_ => "dashboard",
}
}
Expand All @@ -26,7 +27,7 @@
<% if !mobile { %>
<div class="doc-leftnav-container" id="doc-leftnav-container" data-controller="navigation-left-nav-docs" data-turbo-permanent>
<nav class="doc-leftnav" data-scroll="0" data-navigation-left-nav-docs-target="leftNav">
<div class="d-flex flex-column justify-content-between">
<div class="d-flex flex-column justify-content-between doc-leftnav-inner">
<div class="d-xl-flex flex-column py-4">
<div class="pt-2 ps-2 d-flex flex-column gap-4_5">
<% for doc_link in index.clone().into_iter() { %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@ impl MarketingFooter {
StaticNavLink::new("VPC".into(), "/docs/cloud/enterprise/vpc".into()),
],
solutions: vec![
StaticNavLink::new("NLP".into(), "/docs/open-source/pgml/guides/natural-language-processing".into()),
StaticNavLink::new("Supervised Learning".into(), "/docs/open-source/pgml/guides/supervised-learning".into()),
StaticNavLink::new(
"NLP".into(),
"/docs/open-source/pgml/guides/natural-language-processing".into(),
),
StaticNavLink::new(
"Supervised Learning".into(),
"/docs/open-source/pgml/guides/supervised-learning".into(),
),
StaticNavLink::new("Embedding".into(), "/docs/open-source/pgml/guides/embeddings/".into()),
StaticNavLink::new("Vector Database".into(), "/docs/open-source/pgml/guides/vector-database".into()),
StaticNavLink::new(
"Vector Database".into(),
"/docs/open-source/pgml/guides/vector-database".into(),
),
StaticNavLink::new(
"Search".into(),
"/docs/open-source/pgml/guides/improve-search-results-with-machine-learning".into(),
Expand Down