Spaces:
Configuration error
Configuration error
Download packages/server/src/DataSource.ts from Stevross/langflowise: direct link, hf CLI and curl.
- Browser
- Download file 719 Bytes
-
https://huggingface.co/spaces/Stevross/langflowise/resolve/main/packages/server/src/DataSource.ts
- Command line
-
hf download hf://spaces/Stevross/langflowise/packages/server/src/DataSource.ts
-
curl -L -o DataSource.ts https://huggingface.co/spaces/Stevross/langflowise/resolve/main/packages/server/src/DataSource.ts
719 Bytes
| import 'reflect-metadata' | |
| import path from 'path' | |
| import { DataSource } from 'typeorm' | |
| import { ChatFlow } from './entity/ChatFlow' | |
| import { ChatMessage } from './entity/ChatMessage' | |
| import { getUserHome } from './utils' | |
| let appDataSource: DataSource | |
| export const init = async (): Promise<void> => { | |
| const homePath = path.join(getUserHome(), '.flowise') | |
| appDataSource = new DataSource({ | |
| type: 'sqlite', | |
| database: path.resolve(homePath, 'database.sqlite'), | |
| synchronize: true, | |
| entities: [ChatFlow, ChatMessage], | |
| migrations: [] | |
| }) | |
| } | |
| export function getDataSource(): DataSource { | |
| if (appDataSource === undefined) { | |
| init() | |
| } | |
| return appDataSource | |
| } | |