feat: add cohere blog route (#17015)
* feat: add cohere blog route * Update lib/routes/cohere/index.ts
This commit is contained in:
parent
ed41cd766a
commit
00d66286f1
|
|
@ -0,0 +1,54 @@
|
|||
import { Route } from '@/types';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
export const route: Route = {
|
||||
path: ['/blog'],
|
||||
name: 'Blog',
|
||||
url: 'cohere.com/blog',
|
||||
maintainers: ['Loongphy'],
|
||||
handler,
|
||||
example: '/cohere/blog',
|
||||
description: 'Cohere is a platform for building AI applications.',
|
||||
categories: ['blog'],
|
||||
features: {
|
||||
requireConfig: false,
|
||||
requirePuppeteer: false,
|
||||
antiCrawler: false,
|
||||
supportRadar: true,
|
||||
supportBT: false,
|
||||
supportPodcast: false,
|
||||
supportScihub: false,
|
||||
},
|
||||
radar: [
|
||||
{
|
||||
source: ['cohere.com'],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
async function handler() {
|
||||
const { posts: data } = await ofetch('https://cohere-ai.ghost.io/ghost/api/content/posts', {
|
||||
params: {
|
||||
key: '572d288a9364f8e4186af1d60a',
|
||||
limit: 'all',
|
||||
include: ['authors', 'tags'],
|
||||
filter: 'tag:-hash-hidden+tag:-llmu',
|
||||
},
|
||||
});
|
||||
|
||||
const items = data.map((item) => ({
|
||||
title: item.title,
|
||||
link: 'https://cohere.com/blog/' + item.slug,
|
||||
description: item.excerpt,
|
||||
pubDate: parseDate(item.published_at),
|
||||
author: item.authors.map((author) => author.name).join(', '),
|
||||
category: item.tags.map((tag) => tag.name),
|
||||
}));
|
||||
|
||||
return {
|
||||
title: 'The Cohere Blog',
|
||||
link: 'https://cohere.com/blog',
|
||||
item: items,
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import type { Namespace } from '@/types';
|
||||
|
||||
export const namespace: Namespace = {
|
||||
name: 'Cohere',
|
||||
url: 'cohere.com',
|
||||
};
|
||||
Loading…
Reference in New Issue