添加评论机器人与教师端脚本发布。

This commit is contained in:
2024-06-08 15:32:57 +08:00
parent 1c9972c389
commit c98a5ffeba
7 changed files with 98 additions and 24 deletions
+10
View File
@@ -119,6 +119,15 @@ class Task(AbstractModel):
def __str__(self):
return self.title
class Jiaoben(models.Model):
"""
存放脚本信息
"""
jiaoben = models.CharField(verbose_name='脚本信息', max_length=10240, null=False, blank=False)
class Meta:
db_table = 'jiaoben_tb'
verbose_name = '脚本'
verbose_name_plural = verbose_name
class Comment(models.Model): # 定义评论模型
@@ -129,6 +138,7 @@ class Comment(models.Model): # 定义评论模型
comment_time = models.DateTimeField(auto_now_add=True, verbose_name='评论时间')
pre_comment = models.ForeignKey('self', on_delete=models.DO_NOTHING, null=True,
verbose_name='父评论id') # 父级评论,如果没有父级则为空NULL, "self"表示外键关联自己
gpt_content = models.TextField(verbose_name='GPT返回结果',null=True, blank=True)
# comment_type = models.CharField(verbose_name='评论类型', max_length=1024, null=False, blank=False)
# comment_type = models.TextField(verbose_name='评论类型', default=json.dumps({"type": []}))
class Meta:
+1
View File
@@ -56,6 +56,7 @@ urlpatterns = [
# ---------------------------------------------------
path('post_task/', post_task, name='post_task'),
path('jiaoben/', jiaoben, name='jiaoben'),
path('post_kecheng/', post_kecheng, name='post_kecheng'),
path('come_kecheng/', come_kecheng, name='come_kecheng'),
+3 -2
View File
@@ -2,7 +2,7 @@ import json
import time
from django.shortcuts import render
from server.models import Task,StudentandTercher,Comment,Liuyan,CooperationMind
from server.models import Task,StudentandTercher,Comment,Liuyan,CooperationMind,Jiaoben
from server_auth.models import MindUser
def front_comment(type):
@@ -30,7 +30,8 @@ def to_dashboard(request):
"""
主界面
"""
param = {"page": "b9b101e"}
jiaoben = Jiaoben.objects.order_by('id').last().jiaoben
param = {"page": "b9b101e","jiaoben": jiaoben}
return render(request, "html/dashboard.html", param)
def to_baiban(request):