fix: update desktop links and skills market
This commit is contained in:
@@ -633,6 +633,10 @@ pub async fn search_marketplace(
|
|||||||
Ok(results)
|
Ok(results)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
if query.chars().count() < 2 {
|
||||||
|
return Ok(builtin_results);
|
||||||
|
}
|
||||||
|
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"https://skills.sh/api/search?q={}",
|
"https://skills.sh/api/search?q={}",
|
||||||
urlencoding::encode(query)
|
urlencoding::encode(query)
|
||||||
@@ -651,24 +655,46 @@ pub async fn search_marketplace(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let body: serde_json::Value = response.json().await.map_err(|e| e.to_string())?;
|
let body: serde_json::Value = response.json().await.map_err(|e| e.to_string())?;
|
||||||
let items = body["skills"].as_array().cloned().unwrap_or_default();
|
let items = body
|
||||||
|
.get("skills")
|
||||||
|
.or_else(|| body.get("results"))
|
||||||
|
.or_else(|| body.get("items"))
|
||||||
|
.and_then(|value| value.as_array())
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
let mut results: Vec<MarketplaceSkill> = items
|
let mut results: Vec<MarketplaceSkill> = items
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|item| {
|
.map(|item| {
|
||||||
let skill_name = item["name"].as_str().unwrap_or("").to_string();
|
let skill_name = item
|
||||||
let repo = item["source"].as_str().unwrap_or("").to_string();
|
.get("name")
|
||||||
|
.or_else(|| item.get("skillId"))
|
||||||
|
.and_then(|value| value.as_str())
|
||||||
|
.unwrap_or("")
|
||||||
|
.to_string();
|
||||||
|
let repo = item
|
||||||
|
.get("source")
|
||||||
|
.or_else(|| item.get("repo"))
|
||||||
|
.or_else(|| item.get("repository"))
|
||||||
|
.and_then(|value| value.as_str())
|
||||||
|
.unwrap_or("")
|
||||||
|
.trim()
|
||||||
|
.trim_start_matches("https://github.com/")
|
||||||
|
.trim_end_matches(".git")
|
||||||
|
.trim_end_matches('/')
|
||||||
|
.to_string();
|
||||||
let installed =
|
let installed =
|
||||||
installed_refs.contains(&repo.trim().trim_end_matches('/').to_lowercase());
|
installed_refs.contains(&repo.trim().trim_end_matches('/').to_lowercase());
|
||||||
MarketplaceSkill {
|
MarketplaceSkill {
|
||||||
name: skill_name,
|
name: skill_name,
|
||||||
description: String::new(),
|
description: item["description"].as_str().unwrap_or("").to_string(),
|
||||||
repo,
|
repo,
|
||||||
stars: 0,
|
stars: 0,
|
||||||
installs: item["installs"].as_i64().unwrap_or(0),
|
installs: item["installs"].as_i64().unwrap_or(0),
|
||||||
installed,
|
installed,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.filter(|item| !item.repo.trim().is_empty())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
merge_marketplace_results(&mut results, builtin_results);
|
merge_marketplace_results(&mut results, builtin_results);
|
||||||
|
|||||||
@@ -303,7 +303,8 @@ export function TitleBar() {
|
|||||||
}
|
}
|
||||||
}, [message, t]);
|
}, [message, t]);
|
||||||
|
|
||||||
const GITHUB_REPO = 'https://github.com/Boos4721/boos-chat';
|
const GITHUB_PROFILE = 'https://github.com/Boos4721/';
|
||||||
|
const GITHUB_REPO = 'https://github.com/Boos4721/BoosAPI';
|
||||||
const githubMenuItems: MenuProps['items'] = [
|
const githubMenuItems: MenuProps['items'] = [
|
||||||
{
|
{
|
||||||
key: 'feature',
|
key: 'feature',
|
||||||
@@ -323,7 +324,7 @@ export function TitleBar() {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
const handleGithubClick: MenuProps['onClick'] = ({ key }) => {
|
const handleGithubClick: MenuProps['onClick'] = ({ key }) => {
|
||||||
let url = GITHUB_REPO;
|
let url = GITHUB_PROFILE;
|
||||||
if (key === 'feature') url = `${GITHUB_REPO}/issues/new?labels=enhancement&template=feature_request.yml`;
|
if (key === 'feature') url = `${GITHUB_REPO}/issues/new?labels=enhancement&template=feature_request.yml`;
|
||||||
else if (key === 'bug') url = `${GITHUB_REPO}/issues/new?labels=bug&template=bug_report.yml`;
|
else if (key === 'bug') url = `${GITHUB_REPO}/issues/new?labels=bug&template=bug_report.yml`;
|
||||||
if (isTauri()) {
|
if (isTauri()) {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export function AboutPage() {
|
|||||||
<span>{t('settings.website')}</span>
|
<span>{t('settings.website')}</span>
|
||||||
<Button
|
<Button
|
||||||
icon={<Globe size={16} />}
|
icon={<Globe size={16} />}
|
||||||
href="https://boos.lat"
|
href="https://tybossai.com/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
type="link"
|
type="link"
|
||||||
>
|
>
|
||||||
@@ -98,7 +98,7 @@ export function AboutPage() {
|
|||||||
<span>GitHub</span>
|
<span>GitHub</span>
|
||||||
<Button
|
<Button
|
||||||
icon={<Github size={16} />}
|
icon={<Github size={16} />}
|
||||||
href="https://github.com/Boos4721/boos-chat"
|
href="https://github.com/Boos4721/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
type="link"
|
type="link"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user