add quntiganhi and gptfenxi
This commit is contained in:
@@ -45,6 +45,7 @@ urlpatterns = [
|
|||||||
|
|
||||||
path('bianji', JsMindbianjiView.as_view()), # 跳转到协同编辑页面
|
path('bianji', JsMindbianjiView.as_view()), # 跳转到协同编辑页面
|
||||||
path('qunti', to_qunti), # 群体感知
|
path('qunti', to_qunti), # 群体感知
|
||||||
|
path('gptfenxi', to_gpt), # gpt分析
|
||||||
path('pinglun', JsMindpinglunView.as_view()), # 跳转到评论页面
|
path('pinglun', JsMindpinglunView.as_view()), # 跳转到评论页面
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
path('register', MindUserView.as_view()), # 用户注册
|
path('register', MindUserView.as_view()), # 用户注册
|
||||||
|
|||||||
+39
-1
@@ -7,6 +7,35 @@ import matplotlib.pyplot as plt
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from server.models import Task,StudentandTercher,Comment,Liuyan,CooperationMind,Jiaoben,Chat_info
|
from server.models import Task,StudentandTercher,Comment,Liuyan,CooperationMind,Jiaoben,Chat_info
|
||||||
from server_auth.models import MindUser
|
from server_auth.models import MindUser
|
||||||
|
from zhipuai import ZhipuAI
|
||||||
|
def gml_chat(name,messages):
|
||||||
|
print("--------------------")
|
||||||
|
print(messages)
|
||||||
|
client = ZhipuAI(api_key="92a0e4868cda21d22fe6fd0f4c0bf6fb.oZ4IE9PPDOhsLKPp")
|
||||||
|
|
||||||
|
response = client.chat.completions.create(
|
||||||
|
model="glm-3-turbo",
|
||||||
|
# messages=[
|
||||||
|
# {
|
||||||
|
# "role": "user",
|
||||||
|
# "content": prompt
|
||||||
|
# }
|
||||||
|
# ],
|
||||||
|
messages =[{
|
||||||
|
"role": "user",
|
||||||
|
"content": "你现在是一名教育领域专家,请你从清晰性、完整性、布鲁姆认知层级三个方面对学小组作品内容进行分析,给我相应的返回结果即可。小组作品标题是:" + name + "小组作品内容是:" + messages
|
||||||
|
|
||||||
|
}],
|
||||||
|
top_p=0.7,
|
||||||
|
temperature=0.95,
|
||||||
|
max_tokens=1024,
|
||||||
|
stream=True,
|
||||||
|
)
|
||||||
|
content = ""
|
||||||
|
for trunk in response:
|
||||||
|
# print(trunk.choices[0].delta)
|
||||||
|
content = content + trunk.choices[0].delta.content
|
||||||
|
return content
|
||||||
|
|
||||||
def front_comment(type):
|
def front_comment(type):
|
||||||
front_datas = []
|
front_datas = []
|
||||||
@@ -211,7 +240,7 @@ def to_qunti(request):
|
|||||||
print("-----------------------------------------------")
|
print("-----------------------------------------------")
|
||||||
print(pinglun_info)
|
print(pinglun_info)
|
||||||
# chat_content.append()
|
# chat_content.append()
|
||||||
data.append([random.uniform(110,150),random.uniform(100,150),random.uniform(100,150)])
|
data.append([random.uniform(110,150),random.uniform(100,150),random.uniform(100,150),random.uniform(120,150)])
|
||||||
data_time.append([random.uniform(10,20),random.uniform(20,40),random.uniform(40,60),random.uniform(60,80),random.uniform(80,100)])
|
data_time.append([random.uniform(10,20),random.uniform(20,40),random.uniform(40,60),random.uniform(60,80),random.uniform(80,100)])
|
||||||
xyz.append(random.uniform(300,800))
|
xyz.append(random.uniform(300,800))
|
||||||
xyz2.append(random.uniform(200,600))
|
xyz2.append(random.uniform(200,600))
|
||||||
@@ -255,6 +284,15 @@ def to_qunti(request):
|
|||||||
return render(request, "html/echats.html", {"param":param,"name":name,"student":student,"datas":datas,"datas2":datas2,"datas3":datas3,"student4"
|
return render(request, "html/echats.html", {"param":param,"name":name,"student":student,"datas":datas,"datas2":datas2,"datas3":datas3,"student4"
|
||||||
:student4,"sui1":sui1,"sui2":sui2,"sui3":sui3,"sui4":sui4,"sui5":sui5,"sui6":sui6,"sui7":sui7,"sui8":sui8,"sui9":sui9,"datas4":datas4})
|
:student4,"sui1":sui1,"sui2":sui2,"sui3":sui3,"sui4":sui4,"sui5":sui5,"sui6":sui6,"sui7":sui7,"sui8":sui8,"sui9":sui9,"datas4":datas4})
|
||||||
|
|
||||||
|
def to_gpt(request):
|
||||||
|
name = CooperationMind.objects.get(id=request.GET.get('id')).coop_mind_name
|
||||||
|
content = CooperationMind.objects.get(id=request.GET.get('id')).snapshot_data
|
||||||
|
gpt_content = gml_chat(name,content)
|
||||||
|
print(gpt_content)
|
||||||
|
return render(request, "html/gpt.html", {"gpt_content":gpt_content})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def share_to_detail(request):
|
def share_to_detail(request):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -109,6 +109,7 @@
|
|||||||
<a class="dropdown-item" href="javascript:void(0);" onclick="window.open('2_d?id=${item.id}&s_p=b9b101e')">协同脑图</a>
|
<a class="dropdown-item" href="javascript:void(0);" onclick="window.open('2_d?id=${item.id}&s_p=b9b101e')">协同脑图</a>
|
||||||
<a class="dropdown-item" href="javascript:void(0);" onclick="window.open('http://106.54.50.78:9001/p/${item.id}')"> 协同编辑 </a>
|
<a class="dropdown-item" href="javascript:void(0);" onclick="window.open('http://106.54.50.78:9001/p/${item.id}')"> 协同编辑 </a>
|
||||||
<a class="dropdown-item" href="javascript:void(0);" onclick="window.open('qunti?id=${item.id}')">群体感知</a>
|
<a class="dropdown-item" href="javascript:void(0);" onclick="window.open('qunti?id=${item.id}')">群体感知</a>
|
||||||
|
<a class="dropdown-item" href="javascript:void(0);" onclick="window.open('gptfenxi?id=${item.id}')">GPT课程分析</a>
|
||||||
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.open_pinglun(${item.id})">评论</a>
|
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.open_pinglun(${item.id})">评论</a>
|
||||||
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_mind(${item.id},'card_${uuid}')">删除</a>`
|
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_mind(${item.id},'card_${uuid}')">删除</a>`
|
||||||
|
|
||||||
|
|||||||
@@ -642,6 +642,7 @@ option = {
|
|||||||
{ name: '积极', max: 200 },
|
{ name: '积极', max: 200 },
|
||||||
{ name: '消极', max: 200 },
|
{ name: '消极', max: 200 },
|
||||||
{ name: '中立', max: 200 },
|
{ name: '中立', max: 200 },
|
||||||
|
{ name: '困惑', max: 200 },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
|
|||||||
Reference in New Issue
Block a user