# Generated by Django 4.2.23 on 2025-08-23 20:39

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('products', '0104_alter_datalabel_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='ChatSession',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('session_id', models.CharField(db_index=True, max_length=128, unique=True, verbose_name='会话ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('consumer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='chat_sessions', to='products.consumerinfo', verbose_name='消费者')),
                ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='chat_sessions', to='products.tenant', verbose_name='租户')),
            ],
        ),
        migrations.CreateModel(
            name='ChatMessage',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('role', models.CharField(choices=[('user', '用户'), ('assistant', '助手'), ('system', '系统')], max_length=20, verbose_name='角色')),
                ('message_type', models.CharField(choices=[('text', '文本'), ('image', '图片'), ('file', '文件'), ('system', '系统消息'), ('ai_response', 'AI回复')], default='text', max_length=20, verbose_name='消息类型')),
                ('text_content', models.TextField(verbose_name='消息内容')),
                ('file_oss_bucket', models.TextField(blank=True, null=True, verbose_name='文件OSS桶')),
                ('file_oss_path', models.TextField(blank=True, null=True, verbose_name='文件OSS路径')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='发送时间')),
                ('session', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='products.chatsession', verbose_name='会话')),
            ],
        ),
    ]
