This repository was archived by the owner on Jan 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
59 lines (45 loc) · 2.01 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from tortoise.models import Model
from tortoise import fields
class Config(Model):
id = fields.IntField(pk=True, unique=True)
queue_upload_timeout = fields.FloatField()
openai_api_key = fields.TextField()
openai_base_prompt = fields.TextField()
openai_question_regex = fields.TextField()
recaptcha_sitekey = fields.TextField()
twocaptcha_api_key = fields.TextField()
class OpenAIQuery(Model):
id = fields.IntField(pk=True, unique=True)
user = fields.ForeignKeyField('models.User', related_name='openai_queries')
engine = fields.TextField()
prompt = fields.TextField()
temperature = fields.FloatField()
max_tokens = fields.IntField()
response = fields.TextField()
class QueueQuestion(Model):
id = fields.IntField(pk=True, unique=True)
title = fields.TextField()
openai_query = fields.ForeignKeyField('models.OpenAIQuery', related_name='queue_questions')
approved = fields.BooleanField()
approved_user = fields.ForeignKeyField('models.User', null=True, related_name='queue_questions')
upload_attempted = fields.BooleanField()
class User(Model):
id = fields.IntField(pk=True, unique=True)
name = fields.CharField(256, unique=True)
password = fields.TextField()
quora_user = fields.ForeignKeyField('models.QuoraUser', related_name='users')
class UserSession(Model):
token = fields.CharField(256, pk=True, unique=True)
user = fields.ForeignKeyField('models.User', related_name='session')
expires = fields.DatetimeField()
class QuoraUser(Model):
id = fields.IntField(pk=True, unique=True)
email = fields.CharField(256, unique=True)
password = fields.TextField()
formkey = fields.CharField(256, unique=True)
cookie = fields.CharField(256, unique=True)
class QuoraQuestion(Model):
id = fields.CharField(256, pk=True, unique=True)
qid = fields.IntField(unique=True)
time_created = fields.DatetimeField()
queue_question = fields.ForeignKeyField('models.QueueQuestion', null=True, related_name='quora_question')