- Implement dual-agent architecture supporting both Chat Completions and Responses API - Add comprehensive file upload functionality for responses agents with image and PDF support - Integrate OpenAI Conversations API for persistent file context across messages - Add compact UI design with reduced font sizes and tighter spacing for better chat focus - Include vector store management, document upload system, and admin dashboard enhancements - Fix conversation persistence ensuring uploaded files remain accessible in follow-up questions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
134 lines
No EOL
3 KiB
JavaScript
134 lines
No EOL
3 KiB
JavaScript
const { DataTypes } = require('sequelize');
|
|
const { sequelize } = require('../config/database');
|
|
|
|
const Assistant = sequelize.define('Assistant', {
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true,
|
|
},
|
|
key: {
|
|
type: DataTypes.STRING,
|
|
allowNull: false,
|
|
unique: true,
|
|
},
|
|
name: {
|
|
type: DataTypes.STRING,
|
|
allowNull: false,
|
|
},
|
|
description: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false,
|
|
},
|
|
category: {
|
|
type: DataTypes.ENUM(
|
|
'business',
|
|
'creative',
|
|
'personal',
|
|
'technical',
|
|
'educational',
|
|
'health',
|
|
'lifestyle'
|
|
),
|
|
allowNull: false,
|
|
},
|
|
systemPrompt: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false,
|
|
},
|
|
starterMessage: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true,
|
|
},
|
|
model: {
|
|
type: DataTypes.STRING,
|
|
defaultValue: 'gpt-4o',
|
|
},
|
|
temperature: {
|
|
type: DataTypes.FLOAT,
|
|
defaultValue: 0.7,
|
|
validate: {
|
|
min: 0,
|
|
max: 2,
|
|
},
|
|
},
|
|
maxTokens: {
|
|
type: DataTypes.INTEGER,
|
|
defaultValue: 4000,
|
|
},
|
|
reasoningEffort: {
|
|
type: DataTypes.ENUM('low', 'medium', 'high'),
|
|
defaultValue: 'medium',
|
|
allowNull: true,
|
|
comment: 'GPT-5 reasoning effort level'
|
|
},
|
|
agentType: {
|
|
type: DataTypes.ENUM('chat', 'responses'),
|
|
defaultValue: 'chat',
|
|
allowNull: false,
|
|
comment: 'Agent API type: chat (Chat Completions) or responses (Responses API)'
|
|
},
|
|
webSearchEnabled: {
|
|
type: DataTypes.BOOLEAN,
|
|
defaultValue: false,
|
|
allowNull: false,
|
|
comment: 'Enable web search tool for Responses API agents'
|
|
},
|
|
fileSearchEnabled: {
|
|
type: DataTypes.BOOLEAN,
|
|
defaultValue: false,
|
|
allowNull: false,
|
|
comment: 'Enable file search tool for Responses API agents'
|
|
},
|
|
codeInterpreterEnabled: {
|
|
type: DataTypes.BOOLEAN,
|
|
defaultValue: false,
|
|
allowNull: false,
|
|
comment: 'Enable code interpreter tool for Responses API agents'
|
|
},
|
|
vectorStoreIds: {
|
|
type: DataTypes.JSONB,
|
|
defaultValue: [],
|
|
allowNull: false,
|
|
comment: 'Array of vector store IDs for file search'
|
|
},
|
|
maxNumResults: {
|
|
type: DataTypes.INTEGER,
|
|
defaultValue: 20,
|
|
allowNull: false,
|
|
comment: 'Maximum number of results for file search'
|
|
},
|
|
backgroundProcessing: {
|
|
type: DataTypes.BOOLEAN,
|
|
defaultValue: false,
|
|
allowNull: false,
|
|
comment: 'Enable background processing for long-running tasks'
|
|
},
|
|
tools: {
|
|
type: DataTypes.JSONB,
|
|
defaultValue: [],
|
|
},
|
|
metadata: {
|
|
type: DataTypes.JSONB,
|
|
defaultValue: {},
|
|
},
|
|
isActive: {
|
|
type: DataTypes.BOOLEAN,
|
|
defaultValue: true,
|
|
},
|
|
sortOrder: {
|
|
type: DataTypes.INTEGER,
|
|
defaultValue: 0,
|
|
},
|
|
}, {
|
|
tableName: 'assistants',
|
|
timestamps: true,
|
|
indexes: [
|
|
{ fields: ['key'], unique: true },
|
|
{ fields: ['category'] },
|
|
{ fields: ['isActive'] },
|
|
{ fields: ['sortOrder'] },
|
|
],
|
|
});
|
|
|
|
module.exports = Assistant; |