ideas-generator/server/models/Assistant.js
DJP c936e81a47 Complete GPT-5 integration with reasoning effort controls and fix conversation loading
- Implement GPT-5 model support with correct parameters (max_completion_tokens, temperature=1)
- Add configurable reasoning effort levels (low/medium/high) with database migration
- Create admin interface controls for reasoning effort management in agent creation/editing
- Fix conversation loading regression to prevent double-click requirement
- Update home page cards for uniform 280px height with proper text truncation
- Add comprehensive GPT-5 parameter handling in OpenAI service integration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 15:40:25 -04:00

92 lines
No EOL
1.8 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'
},
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;