update
This commit is contained in:
@@ -5,6 +5,8 @@ import * as sequelizeLib from './modules/sequelize.ts';
|
||||
import { useContextKey } from '@kevisual/context';
|
||||
import { SimpleRouter } from '@kevisual/router/simple';
|
||||
import { OssBase } from '@kevisual/oss/services';
|
||||
import { BailianProvider } from '@kevisual/ai';
|
||||
|
||||
export const router = useContextKey('router', () => new SimpleRouter());
|
||||
export const runtime = useContextKey('runtime', () => {
|
||||
return {
|
||||
@@ -41,3 +43,10 @@ const init = () => {
|
||||
});
|
||||
};
|
||||
export const app = useContextKey('app', init);
|
||||
|
||||
export const ai = useContextKey('ai', () => {
|
||||
return new BailianProvider({
|
||||
apiKey: process.env.BAILIAN_API_KEY || '',
|
||||
model: 'qwen-turbo',
|
||||
});
|
||||
});
|
||||
@@ -168,11 +168,12 @@ app
|
||||
.define(async (ctx) => {
|
||||
const tokernUser = ctx.state.tokenUser;
|
||||
const tuid = tokernUser.id;
|
||||
const { id } = ctx.query?.data || {};
|
||||
if (id) {
|
||||
const { id, key } = ctx.query?.data || {};
|
||||
if (id || key) {
|
||||
const search: any = id ? { id } : { key };
|
||||
const config = await ConfigModel.findOne({
|
||||
where: {
|
||||
id,
|
||||
...search
|
||||
},
|
||||
});
|
||||
if (config && config.uid === tuid) {
|
||||
@@ -186,7 +187,7 @@ app
|
||||
if (ossConfig.isEndWithJson(key)) {
|
||||
try {
|
||||
await ossConfig.deleteObject(key);
|
||||
} catch (e) {}
|
||||
} catch (e) { }
|
||||
}
|
||||
await config.destroy();
|
||||
} else {
|
||||
|
||||
@@ -28,6 +28,11 @@ export const defaultKeys = [
|
||||
{
|
||||
key: 'user.json',
|
||||
description: '用户配置',
|
||||
data: { key: 'user', version: '1.0.0', redirectURL: '/root/center/' },
|
||||
data: { key: 'user', version: '1.0.0', redirectURL: '/root/home/' },
|
||||
},
|
||||
{
|
||||
key: 'life.json',
|
||||
description: '生活配置',
|
||||
data: { baseId: '', tableId: '', baseURL: '' },
|
||||
}
|
||||
];
|
||||
|
||||
22
src/test/create-bucket.ts
Normal file
22
src/test/create-bucket.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Client } from 'minio'
|
||||
|
||||
export async function createBucket(client: Client, bucketName: string) {
|
||||
const exists = await client.bucketExists(bucketName)
|
||||
if (!exists) {
|
||||
await client.makeBucket(bucketName, '')
|
||||
console.log(`Bucket "${bucketName}" created successfully.`)
|
||||
} else {
|
||||
console.log(`Bucket "${bucketName}" already exists.`)
|
||||
}
|
||||
}
|
||||
|
||||
const minioClient = new Client({
|
||||
endPoint: 'minio.kevisual.cn',
|
||||
port: 9000,
|
||||
useSSL: false,
|
||||
accessKey: 'admin',
|
||||
secretKey: 'xiongxiao',
|
||||
})
|
||||
createBucket(minioClient, 'nocodb').catch((err) => {
|
||||
console.error('Error creating bucket:', err)
|
||||
})
|
||||
Reference in New Issue
Block a user