mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-03 05:29:12 +00:00
- Rather than having each individual user configure their conversation settings, allow the server admin to configure the OpenAI API key or offline model once, and let all the users re-use that code. - To configure the settings, the admin should go to the `django/admin` page and configure the relevant chat settings. To create an admin, run `python3 src/manage.py createsuperuser` and enter in the details. For simplicity, the email and username should match. - Remove deprecated/unnecessary endpoints and views for configuring per-user chat settings
84 lines
3.3 KiB
Python
84 lines
3.3 KiB
Python
# Generated by Django 4.2.4 on 2023-11-01 17:41
|
|
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("database", "0009_khojapiuser"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="ChatModelOptions",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
("max_prompt_size", models.IntegerField(blank=True, default=None, null=True)),
|
|
("tokenizer", models.CharField(blank=True, default=None, max_length=200, null=True)),
|
|
("chat_model", models.CharField(blank=True, default=None, max_length=200, null=True)),
|
|
(
|
|
"model_type",
|
|
models.CharField(
|
|
choices=[("openai", "Openai"), ("offline", "Offline")], default="openai", max_length=200
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"abstract": False,
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="OfflineChatProcessorConversationConfig",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
("enabled", models.BooleanField(default=False)),
|
|
],
|
|
options={
|
|
"abstract": False,
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="OpenAIProcessorConversationConfig",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
("api_key", models.CharField(max_length=200)),
|
|
],
|
|
options={
|
|
"abstract": False,
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="UserConversationConfig",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"setting",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
default=None,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
to="database.chatmodeloptions",
|
|
),
|
|
),
|
|
(
|
|
"user",
|
|
models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
|
),
|
|
],
|
|
options={
|
|
"abstract": False,
|
|
},
|
|
),
|
|
]
|