mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-27 13:29:15 +07:00
* v2 init * chore: update eslint suppressions and package dependencies - Removed several eslint suppressions related to array sorting and reversing from eslint-suppressions.json to clean up the configuration. - Updated @lobehub/lint package version from 2.0.0-beta.6 to 2.0.0-beta.7 in package.json for improvements and bug fixes. - Made minor formatting adjustments in vitest.config.mts and various SKILL.md files for better readability and consistency. Signed-off-by: Innei <tukon479@gmail.com> * fix: clean up import statements and formatting - Removed unnecessary whitespace in replaceComponentImports.ts for improved readability. - Standardized import statements in contextEngineering.ts and createAgentExecutors.ts by adding missing spaces for consistency. Signed-off-by: Innei <tukon479@gmail.com> * chore: update eslint suppressions and clean up code formatting * 🐛 fix: use vi.hoisted for mock variable initialization Fix TDZ error in persona service test by using vi.hoisted() to ensure mock variables are available when vi.mock factory runs. --------- Signed-off-by: Innei <tukon479@gmail.com>
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { consola } from 'consola';
|
|
import { markdownTable } from 'markdown-table';
|
|
import urlJoin from 'url-join';
|
|
|
|
import type { DataItem } from './const';
|
|
import { AGENT_SPLIT } from './const';
|
|
import {
|
|
fetchAgentIndex,
|
|
genLink,
|
|
genTags,
|
|
getTitle,
|
|
readReadme,
|
|
updateReadme,
|
|
writeReadme,
|
|
} from './utlis';
|
|
|
|
const genAgentTable = (data: DataItem[], lang?: string) => {
|
|
const title = getTitle(lang);
|
|
|
|
const content = data
|
|
.slice(0, 4)
|
|
.map((item) => [
|
|
[
|
|
genLink(
|
|
item.meta.title.replaceAll('|', ','),
|
|
urlJoin('https://lobechat.com/discover/assistant', item.identifier),
|
|
),
|
|
`<sup>By **${genLink(item.author, item.homepage)}** on **${(item as any).createdAt}**</sup>`,
|
|
].join('<br/>'),
|
|
[item.meta.description.replaceAll('|', ','), genTags(item.meta.tags)].join('<br/>'),
|
|
]);
|
|
|
|
return markdownTable([title, ...content]);
|
|
};
|
|
|
|
const runAgentTable = async (lang?: string) => {
|
|
const data = await fetchAgentIndex(lang);
|
|
const md = readReadme(lang);
|
|
const mdTable = genAgentTable(data, lang);
|
|
const newMd = updateReadme(
|
|
AGENT_SPLIT,
|
|
md,
|
|
[
|
|
mdTable,
|
|
`> 📊 Total agents: ${genLink(`<kbd>**${data.length}**</kbd> `, 'https://lobechat.com/discover/assistants')}`,
|
|
].join('\n\n'),
|
|
);
|
|
writeReadme(newMd, lang);
|
|
consola.success(`Sync ${lang || 'en-US'} agent index success!`);
|
|
};
|
|
|
|
export default async () => {
|
|
await runAgentTable();
|
|
await runAgentTable('zh-CN');
|
|
};
|