diff --git a/ai/__pycache__/local_ai_api.cpython-311.pyc b/ai/__pycache__/local_ai_api.cpython-311.pyc index fa9977d..2d4a4fb 100644 Binary files a/ai/__pycache__/local_ai_api.cpython-311.pyc and b/ai/__pycache__/local_ai_api.cpython-311.pyc differ diff --git a/ai/local_ai_api.py b/ai/local_ai_api.py index bcff732..1e72159 100644 --- a/ai/local_ai_api.py +++ b/ai/local_ai_api.py @@ -382,17 +382,11 @@ def _http_request(url: str, method: str, body: Optional[bytes], headers: Dict[st "data": decoded if decoded is not None else response_body, } - error_message = "AI proxy request failed" - if isinstance(decoded, dict): - error_message = decoded.get("error") or decoded.get("message") or error_message - elif response_body: - error_message = response_body - return { "success": False, "status": status, - "error": error_message, - "response": decoded if decoded is not None else response_body, + "error": "AI proxy request failed", + "data": decoded if decoded is not None else response_body, } diff --git a/assets/pasted-20251120-002324-c898244a.png b/assets/pasted-20251120-002324-c898244a.png new file mode 100644 index 0000000..5665a32 Binary files /dev/null and b/assets/pasted-20251120-002324-c898244a.png differ diff --git a/config/__pycache__/settings.cpython-311.pyc b/config/__pycache__/settings.cpython-311.pyc index fd34097..bdf2023 100644 Binary files a/config/__pycache__/settings.cpython-311.pyc and b/config/__pycache__/settings.cpython-311.pyc differ diff --git a/config/settings.py b/config/settings.py index 001b8c8..617e204 100644 --- a/config/settings.py +++ b/config/settings.py @@ -152,3 +152,17 @@ STATICFILES_DIRS = [ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' X_FRAME_OPTIONS = 'ALLOWALL' + +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'handlers': { + 'console': { + 'class': 'logging.StreamHandler', + }, + }, + 'root': { + 'handlers': ['console'], + 'level': 'INFO', + }, +} diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index f0c2919..cd02fcf 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index ef076c1..0580716 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 4722135..2726ef6 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/migrations/0005_alter_message_options_remove_message_is_from_user_and_more.py b/core/migrations/0005_alter_message_options_remove_message_is_from_user_and_more.py new file mode 100644 index 0000000..53bb4c7 --- /dev/null +++ b/core/migrations/0005_alter_message_options_remove_message_is_from_user_and_more.py @@ -0,0 +1,26 @@ +# Generated by Django 5.2.7 on 2025-11-19 23:41 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0004_conversation_message'), + ] + + operations = [ + migrations.AlterModelOptions( + name='message', + options={'ordering': ['created_at']}, + ), + migrations.RemoveField( + model_name='message', + name='is_from_user', + ), + migrations.AddField( + model_name='message', + name='sender', + field=models.CharField(choices=[('user', 'User'), ('ai', 'AI'), ('system', 'System'), ('ai_command', 'AI Command')], default='user', max_length=20), + ), + ] diff --git a/core/migrations/__pycache__/0005_alter_message_options_remove_message_is_from_user_and_more.cpython-311.pyc b/core/migrations/__pycache__/0005_alter_message_options_remove_message_is_from_user_and_more.cpython-311.pyc new file mode 100644 index 0000000..d711cc1 Binary files /dev/null and b/core/migrations/__pycache__/0005_alter_message_options_remove_message_is_from_user_and_more.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 424eaaf..b9cb4ae 100644 --- a/core/models.py +++ b/core/models.py @@ -35,8 +35,11 @@ class Conversation(models.Model): class Message(models.Model): conversation = models.ForeignKey(Conversation, on_delete=models.CASCADE, related_name='messages') content = models.TextField() - is_from_user = models.BooleanField(default=True) + sender = models.CharField(max_length=20, choices=[('user', 'User'), ('ai', 'AI'), ('system', 'System'), ('ai_command', 'AI Command')], default='user') created_at = models.DateTimeField(auto_now_add=True) + class Meta: + ordering = ['created_at'] + def __str__(self): - return f"Message from {'User' if self.is_from_user else 'AI'} at {self.created_at}" \ No newline at end of file + return f"Message from {self.get_sender_display()} at {self.created_at}" \ No newline at end of file diff --git a/core/templates/core/chat.html b/core/templates/core/chat.html index e75bdf1..f832463 100644 --- a/core/templates/core/chat.html +++ b/core/templates/core/chat.html @@ -33,10 +33,24 @@