This commit is contained in:
2025-05-05 22:41:18 +08:00
parent a412c09da0
commit 8891b196ba
12 changed files with 249 additions and 41 deletions

27
src/test/ai.ts Normal file
View File

@@ -0,0 +1,27 @@
import { ProviderManager, SiliconFlowProvider } from '@kevisual/ai-center';
import dotenv from 'dotenv';
import util from 'node:util';
dotenv.config();
import { createQuestion, answer } from '@kevisual/social-prompts/xhs/answer.ts';
const pm = new SiliconFlowProvider({
model: 'Qwen/Qwen3-32B',
apiKey: process.env.SILICONFLOW_API_KEY,
});
const main = async () => {
const usage = await pm.getUsageInfo();
console.log('usage', usage);
};
// main();
const ques = async () => {
// const msg = createQuestion('介绍一下如何安装node在mac当中', '前端的node如何安装环境', answer);
const msg = createQuestion('介绍一下如何安装node在mac当中', '前端的node如何安装环境', answer);
console.log('msg', msg);
const res = await pm.chat(msg);
console.log(util.inspect(res.choices, { depth: null }));
const ans = res.choices[0].message.content;
console.log('ans', ans, ans.length);
};
ques();