generated from kevisual/vite-react-template
feat: 添加仓库管理页面和 AI 功能,优化路由和导航
- 新增仓库列表页面,支持查看和管理 CNB 仓库 - 添加 AI 代理系统和状态管理 - 新增 tags-input、popover、textarea、tooltip 等 UI 组件 - 更新依赖:@kevisual/cnb 升级至 0.0.22,添加 idb-keyval - 改进路由守卫:未配置 API Key 时自动跳转配置页 - 优化 Dialog 遮罩层样式和整体布局 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,43 +1,3 @@
|
||||
import { CNB, Issue } from '@kevisual/cnb'
|
||||
import { useLayoutEffect } from 'react'
|
||||
import { useConfigStore } from './config/store'
|
||||
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
|
||||
import { generateText } from 'ai';
|
||||
const init2 = async () => {
|
||||
const cnb = new CNB({
|
||||
token: 'cIDfLOOIr1Trt15cdnwfndupEZG',
|
||||
cookie: 'CNBSESSION=1770014410.1935321989751226368.7f386c282d80efb5256180ef94c2865e20a8be72e2927a5f8eb1eb72142de39f;csrfkey=2028873452',
|
||||
cors: {
|
||||
baseUrl: 'https://cors.kevisual.cn'
|
||||
}
|
||||
})
|
||||
// const res = await cnb.issue.getList('kevisual/kevisual')
|
||||
// console.log('res', res)
|
||||
const token = await cnb.user.getCurrentUser()
|
||||
console.log('token', token)
|
||||
}
|
||||
import App from './repo/page'
|
||||
|
||||
const initAi = async () => {
|
||||
const state = useConfigStore.getState()
|
||||
const config = state.config
|
||||
const cors = state.config.CNB_CORS_URL
|
||||
const base = cors + '/' + config.AI_BASE_URL.replace('https://', '')
|
||||
const cnb = createOpenAICompatible({
|
||||
baseURL: base,
|
||||
name: 'custom-cnb',
|
||||
apiKey: config.AI_API_KEY,
|
||||
});
|
||||
const model = config.AI_MODEL;
|
||||
// const model = 'hunyuan';
|
||||
const { text } = await generateText({
|
||||
model: cnb(model),
|
||||
prompt: '你好',
|
||||
});
|
||||
console.log('text', text)
|
||||
}
|
||||
export const Home = () => {
|
||||
useLayoutEffect(() => { initAi() }, [])
|
||||
return <div>Home Page</div>
|
||||
}
|
||||
|
||||
export default Home;
|
||||
export default App;
|
||||
Reference in New Issue
Block a user