chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:44:08 +08:00
commit 983960e2dd
1244 changed files with 281996 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import { LogHelper } from '@/helpers/log-helper'
import train from './train'
/**
* Execute the training scripts
*/
;(async () => {
try {
await train()
} catch (e) {
LogHelper.error(`Failed to train: ${e}`)
}
})()
+33
View File
@@ -0,0 +1,33 @@
import fs from 'node:fs'
import path from 'node:path'
import { LLM_SKILL_ROUTER_DUTY_SKILL_LIST_PATH } from '@/constants'
import { SkillDomainHelper } from '@/helpers/skill-domain-helper'
/**
* Train skill router duty
*/
export default () =>
new Promise(async (resolve, reject) => {
try {
const friendlyPrompts = await SkillDomainHelper.listSkillFriendlyPrompts()
const formattedFriendlyPrompts = friendlyPrompts
.map((friendlyPrompt, index) => {
return `${index + 1}. ${friendlyPrompt}`
})
.join('\n')
await fs.promises.mkdir(
path.dirname(LLM_SKILL_ROUTER_DUTY_SKILL_LIST_PATH),
{ recursive: true }
)
await fs.promises.writeFile(
LLM_SKILL_ROUTER_DUTY_SKILL_LIST_PATH,
formattedFriendlyPrompts
)
resolve()
} catch (e) {
reject(e)
}
})
+45
View File
@@ -0,0 +1,45 @@
import dotenv from 'dotenv'
import { PROFILE_DOT_ENV_PATH } from '@/constants'
import { createSetupStatus } from '../setup/setup-status'
import trainSkillRouterDuty from './train-skill-router-duty.js'
dotenv.config({ path: PROFILE_DOT_ENV_PATH })
/**
* Training utterance samples script
*
* pnpm run train [en or fr]
*/
export default (options = {}) =>
new Promise(async (resolve, reject) => {
const { quiet = false } = options
const status = quiet
? null
: createSetupStatus('Training the skill router...').start()
try {
try {
await trainSkillRouterDuty()
if (status) {
status.succeed('Skill router: ready')
}
resolve()
} catch {
if (status) {
status.fail('Failed to train the skill router')
}
reject()
}
} catch (e) {
if (status) {
status.fail('Failed to train the skill router')
}
reject(e)
}
})