Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #16 from palico-ai/docker-compose
Browse files Browse the repository at this point in the history
FIX: SQL Database string size being too small
  • Loading branch information
shikdernyc authored Feb 14, 2024
2 parents 08a8a49 + e506d03 commit 1d4c691
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/cli/__root__/dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ import * as path from 'path'

interface ServeDevServerOptions {
port?: number
forceSync?: boolean
}

export const ServeDevServer = async (options: ServeDevServerOptions): Promise<void> => {
const port = options.port ?? process.env.PORT ?? 8000
const port = options.port ?? 8000
const forceSync = options.forceSync
const projectPath = await CurrentProject.getPackageDirectory()
// Expect this to run after compiled with typescript
nodemon({
script: path.join(__dirname, 'server.js'),
ext: 'ts',
watch: [projectPath],
env: {
PORT: port.toString()
PORT: port.toString(),
FORCE_SYNC_DB: forceSync ? 'true' : 'false'
}
})
}
3 changes: 2 additions & 1 deletion src/cli/__root__/dev/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ const GetJWTToken = async (): Promise<string> => {
export const StartDevServer = async (): Promise<void> => {
const appConfig = await CurrentProject.getApplicationAPIConfig()
const storage = new LocalStorage()
await sequelize.sync({ force: false })
const FORCE_SYNC = process.env.FORCE_SYNC_DB === 'true'
await sequelize.sync({ force: FORCE_SYNC })
const app = new Application({
promptBuilder: appConfig.promptBuilder,
tools: appConfig.toolset?.tools ?? [],
Expand Down
1 change: 1 addition & 0 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const root = new Command()
root.command('dev')
.description('starts local server')
.option('-p, --port <port>', 'port to run server on')
.option('--force-sync', 'force sync database')
.action(ServeDevServer)

root.parse()
6 changes: 3 additions & 3 deletions src/storage/local_storage/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ ConversationCreationAttributes
primaryKey: true
},
toolJSON: {
type: DataTypes.STRING
type: DataTypes.TEXT
},
historyJSON: {
type: DataTypes.STRING
type: DataTypes.TEXT
},
metadataJSON: {
type: DataTypes.STRING
type: DataTypes.TEXT
}
},
{
Expand Down

0 comments on commit 1d4c691

Please sign in to comment.