feat: add neo4j

This commit is contained in:
2024-09-25 14:02:45 +08:00
parent 4cbc72def7
commit 25c055b490
16 changed files with 554 additions and 113 deletions

View File

@@ -41,7 +41,7 @@ RouterCodeModel.init(
type: DataTypes.UUID,
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
comment: '用户id',
comment: '用户code id',
},
path: {
type: DataTypes.STRING,
@@ -60,11 +60,11 @@ RouterCodeModel.init(
defaultValue: 'default',
},
code: {
type: DataTypes.STRING,
type: DataTypes.TEXT,
defaultValue: '',
},
exec: {
type: DataTypes.STRING, // 对代码进行编译后的代码
type: DataTypes.TEXT, // 对代码进行编译后的代码
defaultValue: '',
},
type: {
@@ -93,5 +93,7 @@ RouterCodeModel.init(
tableName: 'cf_router_code',
},
);
// RouterCodeModel.sync({ alter: true });
RouterCodeModel.sync({ alter: true, logging: false }).catch((e) => {
console.error('RouterCodeModel sync', e);
});
// RouterCodeModel.sync({force: true});

18
src/models/prompt.ts Normal file
View File

@@ -0,0 +1,18 @@
import { neode } from '@/app.ts';
export const PromptNeo = neode.model('Prompt', {
id: {
type: 'uuid',
primary: true,
},
title: {
type: 'string',
},
description: 'string',
// profile: { type: 'object', optional: true }, // 用于存储 JSON 对象
prompt: 'string',
// inputVariables: { type: 'array', item },
// tags: { type: 'array', items: 'string', optional: true } // 定义字符串数组
inputVariables: { type: 'string', default: JSON.stringify([]) },
localVariables: { type: 'string', default: JSON.stringify([]) },
});