generated from kevisual/vite-react-template
feat: 添加配置页面和状态管理,集成 AI SDK
This commit is contained in:
17
test/ai.ts
Normal file
17
test/ai.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
|
||||
import { generateText } from 'ai';
|
||||
|
||||
|
||||
const cnb = createOpenAICompatible({
|
||||
baseURL: 'https://api.cnb.cool/kevisual/cnb-ai/-/ai',
|
||||
name: 'custom-cnb',
|
||||
apiKey: 'cIDfLOOIr1Trt15cdnwfndupEZG',
|
||||
});
|
||||
// const model = config.AI_MODEL;
|
||||
const model = 'hunyuan';
|
||||
const { text } = await generateText({
|
||||
model: cnb(model),
|
||||
prompt: 'Say hello in one sentence.',
|
||||
});
|
||||
console.log('text', text)
|
||||
// https://api.cnb.cool
|
||||
Reference in New Issue
Block a user