Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions migrations/pg/20260122122852-chnage_image_url_to_llm_urls.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"use strict";

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
/**
* Add altering commands here.
*
* Example:
* await queryInterface.createTable('users', { id: Sequelize.INTEGER });
*/
await queryInterface.renameColumn("orchestrator_conversation_logs", "image_urls", "user_urls");

await queryInterface.renameColumn("orchestrator_conversation_logs", "urls", "llm_urls");
},

async down(queryInterface, Sequelize) {
/**
* Add reverting commands here.
*
* Example:
* await queryInterface.dropTable('users');
*/
await queryInterface.renameColumn("orchestrator_conversation_logs", "user_urls", "image_urls");

await queryInterface.renameColumn("orchestrator_conversation_logs", "llm_urls", "urls");
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
"use strict";

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
// Drop the orchestrator_history table
await queryInterface.dropTable("orchestrator_history");
},

async down(queryInterface, Sequelize) {
// Recreate the orchestrator_history table if rollback is needed
await queryInterface.createTable("orchestrator_history", {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true,
},
org_id: {
type: Sequelize.STRING,
allowNull: false,
},
thread_id: {
type: Sequelize.STRING,
allowNull: false,
},
sub_thread_id: {
type: Sequelize.STRING,
allowNull: false,
},
model_name: {
type: Sequelize.JSON,
allowNull: false,
},
orchestrator_id: {
type: Sequelize.STRING,
allowNull: false,
},
user: {
type: Sequelize.JSON,
allowNull: false,
},
response: {
type: Sequelize.JSON,
allowNull: true,
},
tool_call_data: {
type: Sequelize.JSON,
allowNull: true,
},
latency: {
type: Sequelize.JSON,
allowNull: true,
},
tokens: {
type: Sequelize.JSON,
allowNull: true,
},
error: {
type: Sequelize.JSON,
allowNull: true,
},
variables: {
type: Sequelize.JSON,
allowNull: true,
},
user_urls: {
type: Sequelize.JSON,
allowNull: true,
},
llm_urls: {
type: Sequelize.JSON,
allowNull: true,
},
ai_config: {
type: Sequelize.JSON,
allowNull: true,
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.NOW,
},
});
},
};
152 changes: 152 additions & 0 deletions models/postgres/orchestrator_conversation_logs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
"use strict";

import { Model } from "sequelize";

export default (sequelize, DataTypes) => {
class orchestrator_conversation_logs extends Model {
static associate() {
// we can define associations here
}
}

orchestrator_conversation_logs.init(
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
llm_message: {
type: DataTypes.JSON,
allowNull: true,
},
user: {
type: DataTypes.JSON,
allowNull: true,
},
chatbot_message: {
type: DataTypes.JSON,
allowNull: true,
},
updated_llm_message: {
type: DataTypes.JSON,
allowNull: true,
},
prompt: {
type: DataTypes.JSON,
allowNull: true,
},
error: {
type: DataTypes.JSON,
allowNull: true,
},
tools_call_data: {
type: DataTypes.JSON,
allowNull: true,
defaultValue: {},
},
message_id: {
type: DataTypes.JSON,
allowNull: true,
},
sub_thread_id: {
type: DataTypes.STRING,
allowNull: true,
},
thread_id: {
type: DataTypes.STRING,
allowNull: true,
},
version_id: {
type: DataTypes.JSON,
allowNull: true,
},
bridge_id: {
type: DataTypes.JSON,
allowNull: true,
},
user_urls: {
type: DataTypes.JSON,
allowNull: true,
defaultValue: [],
},
llm_urls: {
type: DataTypes.JSON,
allowNull: true,
defaultValue: [],
},
AiConfig: {
type: DataTypes.JSON,
allowNull: true,
},
fallback_model: {
type: DataTypes.JSON,
allowNull: true,
},
org_id: {
type: DataTypes.STRING,
allowNull: true,
},
service: {
type: DataTypes.STRING,
allowNull: true,
},
model: {
type: DataTypes.JSON,
allowNull: true,
},
status: {
type: DataTypes.JSON,
allowNull: true,
defaultValue: {},
},
tokens: {
type: DataTypes.JSON,
allowNull: true,
},
variables: {
type: DataTypes.JSON,
allowNull: true,
},
latency: {
type: DataTypes.JSON,
allowNull: true,
},
firstAttemptError: {
type: DataTypes.JSON,
allowNull: true,
},
finish_reason: {
type: DataTypes.JSON,
allowNull: true,
},
agents_path: {
type: DataTypes.ARRAY(DataTypes.STRING),
allowNull: true,
defaultValue: [],
},
created_at: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
field: "created_at",
},
updated_at: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
field: "updated_at",
},
},
{
sequelize,
modelName: "orchestrator_conversation_logs",
tableName: "orchestrator_conversation_logs",
timestamps: true,
createdAt: "created_at",
updatedAt: "updated_at",
}
);

return orchestrator_conversation_logs;
};
96 changes: 0 additions & 96 deletions models/postgres/orchestrator_history.js

This file was deleted.

Loading