Major Features Implemented: - Full Vue.js 3 admin interface with Vite build system - OpenAI Chat Completions API integration (replaced deprecated Assistants API) - PostgreSQL database with Sequelize ORM - Complete conversation management system - User authentication system (admin@oliver.agency, user@oliver.agency) - AI-powered conversation title generation - Server-Sent Events for streaming responses - Conversation soft delete functionality - Rate limiting middleware with development bypass Backend Infrastructure: - Node.js/Express server with comprehensive error handling - Database models: User, Assistant, Conversation, Message - Chat API endpoints with full conversation history context - Conversation CRUD operations with soft delete - Migration and seeding scripts - Environment-based configuration Frontend Features: - Responsive Vue.js interface with router - Real-time chat with streaming responses - Conversation sidebar with delete functionality - Agent selection dropdown - Persistent user sessions with hash-based user IDs - Conversation history loading and continuity - Login system with user role management - Prominent logout functionality Technical Improvements: - Fixed conversation continuity by loading full message history - Implemented conversation title generation using GPT-4o-mini - Added conversation persistence mechanisms (periodic refresh, window focus) - Enhanced error handling and rate limiting - Proper environment variable management - Clean project structure with separated concerns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
83 lines
No EOL
1.6 KiB
JavaScript
83 lines
No EOL
1.6 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(
|
|
'smart-goals',
|
|
'business',
|
|
'creative',
|
|
'personal',
|
|
'technical',
|
|
'educational',
|
|
'health',
|
|
'lifestyle'
|
|
),
|
|
allowNull: false,
|
|
},
|
|
systemPrompt: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false,
|
|
},
|
|
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,
|
|
},
|
|
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; |