Skip to content

Commit c497dfd

Browse files
committed
fix: remove unnecessary param
1 parent 043d5d8 commit c497dfd

File tree

1 file changed

+13
-23
lines changed

1 file changed

+13
-23
lines changed

lib/routes/qwen/blog.ts

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ import cache from '@/utils/cache';
55
import { config } from '@/config';
66

77
export const route: Route = {
8-
path: '/blog/:lang?/:tag?',
8+
path: '/blog/:lang?',
99
categories: ['blog'],
1010
example: '/qwen/blog/zh-cn',
1111
parameters: {
12-
description: `
13-
- \`lang\`: 语言,例如 \`zh-cn\`, \`en\`
14-
- \`tag\`: 博客标签,用于筛选文章,例如 \`Research\`, \`Release\`, \`Open-Source\``,
12+
lang: '语言,例如 `zh-cn`, `en`',
1513
},
1614
features: {
1715
requireConfig: false,
@@ -21,17 +19,11 @@ export const route: Route = {
2119
supportPodcast: false,
2220
supportScihub: false,
2321
},
24-
radar: [
25-
{
26-
source: ['qwen.ai/research/'],
27-
target: '/qwen/blog/:lang',
28-
},
29-
],
3022
name: 'Blog',
3123
maintainers: ['Kjasn'],
3224
handler: async (ctx) => {
3325
const base = 'https://qwen.ai';
34-
const { lang = 'zh-cn', tag = '' } = ctx.req.param();
26+
const { lang = 'zh-cn' } = ctx.req.param();
3527
const blogUrl = `${base}/api/page_config?code=research.research-list&language=${lang}`;
3628

3729
const response = await ofetch(blogUrl, {
@@ -41,17 +33,15 @@ export const route: Route = {
4133
},
4234
});
4335

44-
const articles = response
45-
.filter((item: any) => !tag || item.tags?.includes(tag)) // filter by tag
46-
.map((item: any) => ({
47-
title: item.title,
48-
image: item.cover_small, // or item.cover
49-
pubDate: item.date,
50-
author: item.author,
51-
link: `${base}/blog?id=${item.id}`,
52-
description: item.introduction,
53-
category: item.tags,
54-
}));
36+
const articles = response.map((item: any) => ({
37+
title: item.title,
38+
image: item.cover_small, // or item.cover
39+
pubDate: item.date,
40+
author: item.author,
41+
link: `${base}/blog?id=${item.id}`,
42+
description: item.introduction,
43+
category: item.tags,
44+
}));
5545

5646
// get blog content
5747
const items = await Promise.all(
@@ -67,7 +57,7 @@ export const route: Route = {
6757

6858
return {
6959
title: 'Qwen Blog',
70-
link: blogUrl,
60+
link: `${base}/research`,
7161
item: items,
7262
};
7363
},

0 commit comments

Comments
 (0)