Migrated from design-system-swarm with fresh git history.
Old project history preserved in /home/overbits/apps/design-system-swarm
Core components:
- MCP Server (Python FastAPI with mcp 1.23.1)
- Claude Plugin (agents, commands, skills, strategies, hooks, core)
- DSS Backend (dss-mvp1 - token translation, Figma sync)
- Admin UI (Node.js/React)
- Server (Node.js/Express)
- Storybook integration (dss-mvp1/.storybook)
Self-contained configuration:
- All paths relative or use DSS_BASE_PATH=/home/overbits/dss
- PYTHONPATH configured for dss-mvp1 and dss-claude-plugin
- .env file with all configuration
- Claude plugin uses ${CLAUDE_PLUGIN_ROOT} for portability
Migration completed: $(date)
🤖 Clean migration with full functionality preserved
100 lines
1.9 KiB
JavaScript
100 lines
1.9 KiB
JavaScript
import { DataTypes } from 'sequelize';
|
|
import sequelize from '../config/database.js';
|
|
|
|
const AIChat = sequelize.define('AIChat', {
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true
|
|
},
|
|
projectId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: true,
|
|
references: {
|
|
model: 'projects',
|
|
key: 'id'
|
|
}
|
|
},
|
|
userId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: false,
|
|
references: {
|
|
model: 'users',
|
|
key: 'id'
|
|
}
|
|
},
|
|
sessionId: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
index: true
|
|
},
|
|
messageType: {
|
|
type: DataTypes.ENUM('claude-query', 'ai-query', 'navigation-gen', 'token-save'),
|
|
allowNull: false
|
|
},
|
|
status: {
|
|
type: DataTypes.ENUM('pending', 'processing', 'completed', 'failed'),
|
|
defaultValue: 'pending',
|
|
index: true
|
|
},
|
|
userMessage: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false
|
|
},
|
|
aiResponse: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true
|
|
},
|
|
generatedCode: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true
|
|
},
|
|
navigationStructure: {
|
|
type: DataTypes.JSON,
|
|
allowNull: true
|
|
},
|
|
tokens: {
|
|
type: DataTypes.JSON,
|
|
allowNull: true
|
|
},
|
|
inputTokens: {
|
|
type: DataTypes.INTEGER,
|
|
defaultValue: 0
|
|
},
|
|
outputTokens: {
|
|
type: DataTypes.INTEGER,
|
|
defaultValue: 0
|
|
},
|
|
model: {
|
|
type: DataTypes.STRING,
|
|
defaultValue: 'mock-ai-v1'
|
|
},
|
|
error: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true
|
|
},
|
|
metadata: {
|
|
type: DataTypes.JSON,
|
|
defaultValue: {}
|
|
},
|
|
startedAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: true
|
|
},
|
|
completedAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: true
|
|
}
|
|
}, {
|
|
tableName: 'ai_chats',
|
|
timestamps: true,
|
|
indexes: [
|
|
{ fields: ['userId', 'createdAt'] },
|
|
{ fields: ['projectId', 'status'] },
|
|
{ fields: ['sessionId'] },
|
|
{ fields: ['status'] }
|
|
]
|
|
});
|
|
|
|
export default AIChat;
|