Skip to content

Commit

Permalink
feat:调整插件顺序,大模型API供应放在最前面 (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinie13 authored Oct 22, 2024
1 parent 511141b commit 1101158
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/pages/plugin/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ const Functionality = {
{ key: 'others', label: '其他工具' },
]
},
authentication: {description:"认证"},
transformation:{description:"转换"},
traffic: {description:"流量"},
security: {description:"安全"},
authentication: { description: "认证" },
transformation: { description: "转换" },
traffic: { description: "流量" },
security: { description: "安全" },
};
const lang = ifzh ? "zh-cn" : "en"
const lang = ifzh ? "zh-cn" : "en";
// 拿到插件的文档
const posts = await getCollection("docs", (item) => {
Expand All @@ -53,23 +53,30 @@ const dataSource = posts
const functionality = Functionality[key];
// 查找ai 副标题
const secondaryTitle = (functionality?.children && functionality.children.find(child => child.key === childKey)?.label) || '';
return {
Img: "",
Title: item.data.title,
Tiers: "企业版",
Des: item.data.description,
Link: generateLink(item.slug),
SecondaryTitle: secondaryTitle,
Functionality: functionality?.description || '',
Functionality: functionality?.description || "",
SupportBy: "Higress",
GithubHigressUrl: item.data.githubHigressUrl || `https://github.com/alibaba/higress/tree/main/plugins/wasm-go/extensions/${item.slug.split('/').pop()}`,
GithubHigressUrl:
item.data.githubHigressUrl ||
`https://github.com/alibaba/higress/tree/main/plugins/wasm-go/extensions/${item.slug.split("/").pop()}`,
};
})
.filter((item) => item.Functionality);
.filter((item) => item.Functionality)
.sort((a, b) => {
// 将“大模型API供应”(key: ai,childKey: api-provider)放在最前面
if (a.SecondaryTitle === "大模型API供应") return -1;
if (b.SecondaryTitle === "大模型API供应") return 1;
return 0; // 默认不改变顺序
});
---

<BaseLayout title={t('plugin.title')} description={t('plugin.description')}>
<BaseLayout title={t("plugin.title")} description={t("plugin.description")}>
<PluginIntroduce />
<PluginHub client:load dataSource={dataSource} />
<CloudFooter />
Expand Down

0 comments on commit 1101158

Please sign in to comment.