从零开始的基于Django的Web开发

目录

前言

工具的准备

调用文心一言实现作文评分

参赛感悟


前言

暑假刚刚放假,在家里睡了两天(弥补了期末周的歇斯底里)突然想写点东西,正好趁着这时间,我总结下自己寒假做的系统。在讲开发前,我想先介绍下这个项目的出身。当时和同学组队参加服务外包大赛,我们选了百度的A01题,调用文心一言完成试卷的自动化批阅,我作为队里的开发成员,负责开发Web实现需求。今年比赛赛题出的很晚,我记得23年年底才发布赛题,当时又是期末周正在肝期末,所以比赛只能动用寒假时间做了,我学的django是跟着武沛齐老师做的,包括用的Bootstrap包也是课程里的。接下来我就结合自己的理解,分享下自己的开发历程。

工具的准备

Pycharm的安装及使用,可以参考:

Pycharm专业版的安装及免费使用

安装django

pip install django -i https://pypi.tuna.tsinghua.edu.cn/simple

 购买文心一言token,详情见:

https://ai.baidu.com/ai-doc/AISTUDIO/slmkadt9z

 安装ERNIE Bot

pip install erniebot==0.5.0

调用文心一言实现作文评分

文心一言的基础使用

 前端页面:

{% extends 'layout.html' %}
{% load static %}

{% block css %}
    <link rel="stylesheet" href="{% static 'plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css' %}">
    <link rel="stylesheet" href="{% static 'css/index.css' %}">
    <link rel="stylesheet" href="{% static 'css/dianping.css' %}">
    {#<link rel="stylesheet" href="{% static 'css/style.css' %}">#}
{% endblock %}


{% block content %}
    <div style="display: flex; flex-direction: column; height: 100vh;">
        <h1 style="margin-top: 4%;font-family: '楷体', cursive;font-size: 40px;text-align: center;text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);">
            作文智能评阅
            <span>
                <a href="#">
                <svg t="1711096486488" class="icon" viewBox="0 0 1024 1024" version="1.1"
                     xmlns="http://www.w3.org/2000/svg"
                     p-id="6151" width="32" height="32 left:10px;">
                    <path d="M208.229805 13.653333a781.084444 781.084444 0 0 1-48.924445 102.968889V449.422222h-46.08V189.44a446.577778 446.577778 0 0 1-40.391111 48.355556 284.444444 284.444444 0 0 0-25.6-47.786667A547.271111 547.271111 0 0 0 164.42536 0z m148.48 109.226667v62.577778H490.967582V227.555556H356.709805v65.422222h141.084444v42.666666H356.709805v113.777778h-46.648889V122.88h-27.306667A506.88 506.88 0 0 1 215.62536 221.866667 277.617778 277.617778 0 0 0 178.078693 190.577778 523.377778 523.377778 0 0 0 286.736471 3.413333l43.804445 11.946667c-7.964444 21.048889-16.497778 42.666667-25.6 63.715556h197.973333v43.804444zM985.332027 381.155556v45.511111H551.838693v-45.511111h132.551112V4.551111h46.648888V381.155556H803.856471V5.12h46.648889V381.155556z m-361.244445-84.195556a1429.048889 1429.048889 0 0 0-62.577777-177.493333l42.097777-13.084445a1702.684444 1702.684444 0 0 1 67.128889 174.648889z m353.848889-170.666667a1458.631111 1458.631111 0 0 1-81.92 170.666667L860.74536 281.031111a1001.813333 1001.813333 0 0 0 77.937778-170.666667zM508.034249 526.222222c-227.555556 0-500.622222 200.817778-500.622222 247.466667S266.82536 1024 519.412027 1024s494.933333-213.333333 494.933333-248.035556-277.617778-252.017778-506.311111-249.742222z m0 439.751111c-126.862222 0-227.555556-85.902222-227.555556-192.284444s102.968889-192.284444 227.555556-192.284445 227.555556 85.902222 227.555556 192.284445S636.603138 967.111111 509.740916 967.111111z"
                          fill="#1296db" p-id="6152"></path>
                    <path d="M509.740916 773.688889m-129.137778 0a129.137778 129.137778 0 1 0 258.275555 0 129.137778 129.137778 0 1 0-258.275555 0Z"
                          fill="#1296db" p-id="6153"></path>
                </svg>
            </a>
                <svg t="1711098712103" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
                 p-id="6892" width="32" height="32">
                <path d="M750.933333 42.666667v938.666666c0 23.466667-19.2 42.666667-42.666666 42.666667H42.666667c-23.466667 0-42.666667-19.2-42.666667-42.666667V189.866667L189.866667 0h518.4c23.466667 0 42.666667 19.2 42.666666 42.666667z"
                      fill="#F2F2F2" p-id="6893"></path>
                <path d="M113.066667 337.066667h524.8v53.333333H113.066667zM113.066667 497.066667h524.8v53.333333H113.066667zM113.066667 659.2h524.8v53.333333H113.066667zM113.066667 819.2h253.866666v53.333333H113.066667zM381.866667 177.066667h253.866666v53.333333H381.866667z"
                      fill="#CDD5DF" p-id="6894"></path>
                <path d="M189.866667 147.2V0L0 189.866667h147.2c23.466667 0 42.666667-19.2 42.666667-42.666667z"
                      fill="#65C5B8" p-id="6895"></path>
                <path d="M573.866667 964.266667l-61.866667 19.2 19.2-61.866667z" fill="#334A5E" p-id="6896"></path>
                <path d="M552.533333 853.333333l-25.6 78.933334-14.933333 51.2 49.066667-17.066667 78.933333-23.466667 4.266667-85.333333z"
                      fill="#FFCF5C" p-id="6897"></path>
                <path d="M561.066667 966.4l-49.066667 17.066667 14.933333-51.2z" fill="#334A5E" p-id="6898"></path>
                <path d="M902.4 563.2L586.666667 876.8c-8.533333 8.533333-8.533333 21.333333 0 29.866667 8.533333 8.533333 21.333333 8.533333 29.866666 0l313.6-313.6-27.733333-29.866667z"
                      fill="#54C0EB" p-id="6899"></path>
                <path d="M870.4 531.2L556.8 846.933333c-8.533333 8.533333-8.533333 21.333333 0 29.866667 8.533333 8.533333 21.333333 8.533333 29.866667 0l313.6-313.6-29.866667-32z"
                      fill="#84DBFF" p-id="6900"></path>
                <path d="M932.266667 593.066667L618.666667 906.666667c-8.533333 8.533333-8.533333 21.333333 0 29.866666 8.533333 8.533333 21.333333 8.533333 29.866666 0l313.6-313.6-29.866666-29.866666z"
                      fill="#84DBFF" p-id="6901"></path>
                <path d="M888.896 514.965333l92.010667 92.010667-18.090667 18.090667-92.032-92.010667z" fill="#FFD15C"
                      p-id="6902"></path>
                <path d="M1011.2 514.133333L981.333333 482.133333c-17.066667-17.066667-42.666667-17.066667-59.733333 0l-32 32 91.733333 91.733334 32-32c14.933333-17.066667 14.933333-42.666667-2.133333-59.733334z"
                      fill="#FF7058" p-id="6903"></path>
            </svg>
                <svg t="1711100303108" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
                 p-id="11945" width="32" height="32">
                <path d="M633.6 1004.8c-57.6 0-115.2-6.4-179.2-32-224-89.6-416 0-416 0-6.4 6.4-19.2 0-19.2-6.4-6.4-6.4 0-19.2 6.4-19.2 6.4-6.4 204.8-96 441.6 0 224 89.6 435.2-44.8 435.2-44.8 6.4-6.4 19.2 0 19.2 6.4 6.4 6.4 0 19.2-6.4 19.2 0 0-121.6 76.8-281.6 76.8z"
                      fill="#3DA6FF" p-id="11946"></path>
                <path d="M972.8 166.4L800 32c-38.4-32-96-19.2-121.6 19.2l-384 499.2s44.8 0 96 12.8l326.4-428.8 32 25.6-320 422.4c32 19.2 70.4 44.8 102.4 76.8l320-422.4 32 25.6-320 441.6c19.2 25.6 32 51.2 44.8 89.6l384-499.2c25.6-44.8 19.2-96-19.2-128zM448 684.8c-57.6-44.8-134.4-64-147.2-64-19.2-6.4-25.6 0-32 12.8 0 19.2-12.8 249.6-12.8 268.8 0 12.8 12.8 25.6 25.6 19.2 19.2-6.4 236.8-76.8 249.6-83.2 12.8-6.4 12.8-19.2 6.4-32 6.4-12.8-32-76.8-89.6-121.6z"
                      fill="#3DA6FF" p-id="11947"></path>
            </svg>
            </span>

        </h1>
        <div style="background-color: #FFFFFF;text-align: center;">
            <div class="contt">
                <input type="file" id="file-input" style="display: none;">
                <div id="select-button">
                    <div class="drop-area" style="cursor: pointer;width: 300px;height: 50vh;
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
                gap: 20px;
                color: #8c8c8c;
                border: 6px dashed #bfbfbf;
                border-radius: 16px;
                user-select: none;" id="drop-area">
                        <img id="image-preview" src="#" alt="图片预览" style="width: 100%;height: 100%;display: none;">
                        <div id="upload">
                            <img src="https://img-qn.51miz.com/Element/00/77/23/91/543df2ac_E772391_aef46f8c.png"
                                 alt="">
                            <p class="tip">点击进行上传</p>
                        </div>
                    </div>
                </div>

                <div style="display: flex;justify-content: center;align-items: center;margin-top:20px;">
                    <div style="display: flex;justify-content: center;align-items: center">
                        <button class="btn" onclick="submitQuestion(this,'review')">开始评阅</button>
                        <button class="btn" onclick="submitQuestion(this,'export')">开始导出</button>
                    </div>
                </div>
            </div>
            <div style="margin-top: 3%;display: none;" id="infos">
                <div style="background-color: rgb(255,255,255); display: flex; flex-direction: column; flex: 75%; margin-left: 750px;width: 600px;">
                    <div style="flex: 50%; display: flex; ">
                        <!-- 左上分区 -->
                        <div style="flex: 50%;">
                            <div class="carddiy1" style="margin-left: 35%;">
                                <div class="top" style="background-color: rgb(133, 171, 218);">
                                    <svg t="1710853784560" class="icon" viewBox="0 0 1332 1024" version="1.1"
                                         xmlns="http://www.w3.org/2000/svg" p-id="4290" width="30" height="30">
                                        <path
                                                d="M1315.41416 444.123297l-193.019175 192.916777c-12.825279 12.79968-18.661933 31.231219-15.641209 49.304367l45.566861 272.377191c6.01585 36.0183-21.861853 65.252769-53.528262 65.252769-8.345391 0-16.972376-2.047949-25.317767-6.527837l-238.586035-128.611185a53.349066 53.349066 0 0 0-50.609935-0.076798l-238.662833 128.508787a52.990675 52.990675 0 0 1-25.343367 6.297443c-31.666408 0-59.697708-29.61846-53.681858-65.636759l45.720457-272.300393C513.207015 629.20667 460.98432 665.58336 460.98432 665.58336c-2.150346-0.742381-21.503462-1.049574-38.911027 12.0317L281.7888 767.9808c-7.60301 5.683058-42.955726 25.59936-51.19872 25.59936-21.247469 0-26.060148-26.674533-25.59936-51.19872v-179.19552c0.255994-13.516462-12.79968-26.879328-23.705007-34.661533L17.040219 411.074523c-27.442514-19.634709-20.453889-62.692833 11.852504-72.830179l193.326366-60.82408c12.825279-4.0191 22.911427-14.335642 26.956127-27.263318l61.156871-195.041524c5.887853-18.713132 22.527437-29.695258 39.269418-29.695258 12.364491 0 24.754581 4.0191 32.946376 15.794806l115.683508 163.17032c7.577411 10.854129 19.916302 11.18692 33.099973 11.186921h0.588785l108.822879 4.556686c-8.089398 15.718007-22.885828 32.767181-40.088597 35.327117l-148.450689 15.9996L358.58688 127.9968l-34.866328 147.477913c3.19992-10.137347-12.441289 58.648134-78.692433 79.460414L102.59328 383.9904l123.337717 78.103648c32.511187 23.244219 56.625784 60.440089 55.857803 101.091872v127.9968l94.180046-78.948426C419.052569 579.902302 492.727527 589.322867 460.98432 588.78528l-153.59616-153.59616c16.40919 16.40919-64.663983-46.258044 25.59936-76.79808l179.19552-25.59936 76.79808-25.59936c28.594485-4.249494 76.081298-100.631084 51.19872-51.19872l120.675384-224.941576A53.60506 53.60506 0 0 1 809.596405 0c19.378716 0 38.757431 10.367741 48.715582 31.052024l119.318617 247.827404a54.449839 54.449839 0 0 0 40.907777 30.488838l266.796531 39.730207c44.568486 6.655834 62.360041 62.79523 30.079248 95.024824z m-308.088298-55.038624c-43.160521-6.425439-80.509987-34.584735-99.863104-74.826929l-97.866353-203.898903L691.37856 307.19232c10.39334-21.60586-51.19872 76.79808-51.19872 76.79808l-246.137846 37.835854 170.542936 149.884253 25.752956 113.277168C571.496757 767.929602 537.7824 947.176321 537.7824 947.176321l208.276393-129.148772c-18.482738 9.958151 8.575786-9.369366 61.899253-9.57416-58.80173 0.742381 39.474213-3.839904 63.128022 8.908577L1075.368961 921.576961l-51.19872-281.592961c3.251119 19.481113-15.154821-2.227144 43.698107-61.105672l157.256869-157.20567-217.799355-32.587985z"
                                                fill="#ffffff" p-id="4291"></path>
                                    </svg>
                                    <style>
                                        .svg2 {
                                            fill: #b197fc;
                                            height: 40px;
                                            width: 40px;
                                        }
                                    </style>
                                    </svg>
                                </div>
                                <div class="bottom">
                                    <span class="botm_ph" id="content_box1" style="text-align: center;"></span>
                                    <button onclick="editContent('content_box1')" class="edit">编辑</button>
                                </div>
                            </div>
                        </div>
                        <!-- 右上分区 -->
                        <div style="flex: 50%;height: 100px">
                            <div class="carddiy1" style="margin-left: 5%">
                                <div class="top" style="background-color: rgb(133, 171, 218);">
                                    <svg t="1710853784560" class="icon" viewBox="0 0 1332 1024" version="1.1"
                                         xmlns="http://www.w3.org/2000/svg" p-id="4290" width="30" height="30">
                                        <path
                                                d="M1315.41416 444.123297l-193.019175 192.916777c-12.825279 12.79968-18.661933 31.231219-15.641209 49.304367l45.566861 272.377191c6.01585 36.0183-21.861853 65.252769-53.528262 65.252769-8.345391 0-16.972376-2.047949-25.317767-6.527837l-238.586035-128.611185a53.349066 53.349066 0 0 0-50.609935-0.076798l-238.662833 128.508787a52.990675 52.990675 0 0 1-25.343367 6.297443c-31.666408 0-59.697708-29.61846-53.681858-65.636759l45.720457-272.300393C513.207015 629.20667 460.98432 665.58336 460.98432 665.58336c-2.150346-0.742381-21.503462-1.049574-38.911027 12.0317L281.7888 767.9808c-7.60301 5.683058-42.955726 25.59936-51.19872 25.59936-21.247469 0-26.060148-26.674533-25.59936-51.19872v-179.19552c0.255994-13.516462-12.79968-26.879328-23.705007-34.661533L17.040219 411.074523c-27.442514-19.634709-20.453889-62.692833 11.852504-72.830179l193.326366-60.82408c12.825279-4.0191 22.911427-14.335642 26.956127-27.263318l61.156871-195.041524c5.887853-18.713132 22.527437-29.695258 39.269418-29.695258 12.364491 0 24.754581 4.0191 32.946376 15.794806l115.683508 163.17032c7.577411 10.854129 19.916302 11.18692 33.099973 11.186921h0.588785l108.822879 4.556686c-8.089398 15.718007-22.885828 32.767181-40.088597 35.327117l-148.450689 15.9996L358.58688 127.9968l-34.866328 147.477913c3.19992-10.137347-12.441289 58.648134-78.692433 79.460414L102.59328 383.9904l123.337717 78.103648c32.511187 23.244219 56.625784 60.440089 55.857803 101.091872v127.9968l94.180046-78.948426C419.052569 579.902302 492.727527 589.322867 460.98432 588.78528l-153.59616-153.59616c16.40919 16.40919-64.663983-46.258044 25.59936-76.79808l179.19552-25.59936 76.79808-25.59936c28.594485-4.249494 76.081298-100.631084 51.19872-51.19872l120.675384-224.941576A53.60506 53.60506 0 0 1 809.596405 0c19.378716 0 38.757431 10.367741 48.715582 31.052024l119.318617 247.827404a54.449839 54.449839 0 0 0 40.907777 30.488838l266.796531 39.730207c44.568486 6.655834 62.360041 62.79523 30.079248 95.024824z m-308.088298-55.038624c-43.160521-6.425439-80.509987-34.584735-99.863104-74.826929l-97.866353-203.898903L691.37856 307.19232c10.39334-21.60586-51.19872 76.79808-51.19872 76.79808l-246.137846 37.835854 170.542936 149.884253 25.752956 113.277168C571.496757 767.929602 537.7824 947.176321 537.7824 947.176321l208.276393-129.148772c-18.482738 9.958151 8.575786-9.369366 61.899253-9.57416-58.80173 0.742381 39.474213-3.839904 63.128022 8.908577L1075.368961 921.576961l-51.19872-281.592961c3.251119 19.481113-15.154821-2.227144 43.698107-61.105672l157.256869-157.20567-217.799355-32.587985z"
                                                fill="#ffffff" p-id="4291"></path>
                                    </svg>
                                    <style>
                                        .svg2 {
                                            fill: #b197fc;
                                            height: 40px;
                                            width: 40px;
                                        }
                                    </style>
                                    </svg>
                                </div>
                                <div class="bottom">
                                    <span class="botm_ph" id="content_box2" style="text-align: center;"></span>
                                    <button onclick="editContent('content_box2')">编辑</button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div style="flex: 50%; display: flex;  margin-top:10px;">
                        <!-- 左上分区 -->
                        <div style="flex: 50%;">
                            <div class="carddiy1" style="margin-left: 35%;">
                                <div class="top" style="background-color: rgb(133, 171, 218);">
                                    <svg t="1710853784560" class="icon" viewBox="0 0 1332 1024" version="1.1"
                                         xmlns="http://www.w3.org/2000/svg" p-id="4290" width="30" height="30">
                                        <path
                                                d="M1315.41416 444.123297l-193.019175 192.916777c-12.825279 12.79968-18.661933 31.231219-15.641209 49.304367l45.566861 272.377191c6.01585 36.0183-21.861853 65.252769-53.528262 65.252769-8.345391 0-16.972376-2.047949-25.317767-6.527837l-238.586035-128.611185a53.349066 53.349066 0 0 0-50.609935-0.076798l-238.662833 128.508787a52.990675 52.990675 0 0 1-25.343367 6.297443c-31.666408 0-59.697708-29.61846-53.681858-65.636759l45.720457-272.300393C513.207015 629.20667 460.98432 665.58336 460.98432 665.58336c-2.150346-0.742381-21.503462-1.049574-38.911027 12.0317L281.7888 767.9808c-7.60301 5.683058-42.955726 25.59936-51.19872 25.59936-21.247469 0-26.060148-26.674533-25.59936-51.19872v-179.19552c0.255994-13.516462-12.79968-26.879328-23.705007-34.661533L17.040219 411.074523c-27.442514-19.634709-20.453889-62.692833 11.852504-72.830179l193.326366-60.82408c12.825279-4.0191 22.911427-14.335642 26.956127-27.263318l61.156871-195.041524c5.887853-18.713132 22.527437-29.695258 39.269418-29.695258 12.364491 0 24.754581 4.0191 32.946376 15.794806l115.683508 163.17032c7.577411 10.854129 19.916302 11.18692 33.099973 11.186921h0.588785l108.822879 4.556686c-8.089398 15.718007-22.885828 32.767181-40.088597 35.327117l-148.450689 15.9996L358.58688 127.9968l-34.866328 147.477913c3.19992-10.137347-12.441289 58.648134-78.692433 79.460414L102.59328 383.9904l123.337717 78.103648c32.511187 23.244219 56.625784 60.440089 55.857803 101.091872v127.9968l94.180046-78.948426C419.052569 579.902302 492.727527 589.322867 460.98432 588.78528l-153.59616-153.59616c16.40919 16.40919-64.663983-46.258044 25.59936-76.79808l179.19552-25.59936 76.79808-25.59936c28.594485-4.249494 76.081298-100.631084 51.19872-51.19872l120.675384-224.941576A53.60506 53.60506 0 0 1 809.596405 0c19.378716 0 38.757431 10.367741 48.715582 31.052024l119.318617 247.827404a54.449839 54.449839 0 0 0 40.907777 30.488838l266.796531 39.730207c44.568486 6.655834 62.360041 62.79523 30.079248 95.024824z m-308.088298-55.038624c-43.160521-6.425439-80.509987-34.584735-99.863104-74.826929l-97.866353-203.898903L691.37856 307.19232c10.39334-21.60586-51.19872 76.79808-51.19872 76.79808l-246.137846 37.835854 170.542936 149.884253 25.752956 113.277168C571.496757 767.929602 537.7824 947.176321 537.7824 947.176321l208.276393-129.148772c-18.482738 9.958151 8.575786-9.369366 61.899253-9.57416-58.80173 0.742381 39.474213-3.839904 63.128022 8.908577L1075.368961 921.576961l-51.19872-281.592961c3.251119 19.481113-15.154821-2.227144 43.698107-61.105672l157.256869-157.20567-217.799355-32.587985z"
                                                fill="#ffffff" p-id="4291"></path>
                                    </svg>
                                    <style>
                                        .svg2 {
                                            fill: #b197fc;
                                            height: 40px;
                                            width: 40px;
                                        }
                                    </style>
                                    </svg>
                                </div>
                                <div class="bottom">
                                    <span class="botm_ph" id="content_box3" style="text-align: center;"></span>
                                    <button onclick="editContent('content_box3')">编辑</button>
                                </div>
                            </div>
                        </div>
                        <!-- 右上分区 -->
                        <div style="flex: 50%;">
                            <div class="carddiy1" style="margin-left: 5%">
                                <div class="top" style="background-color: rgb(133, 171, 218);">
                                    <svg t="1710853784560" class="icon" viewBox="0 0 1332 1024" version="1.1"
                                         xmlns="http://www.w3.org/2000/svg" p-id="4290" width="30" height="30">
                                        <path
                                                d="M1315.41416 444.123297l-193.019175 192.916777c-12.825279 12.79968-18.661933 31.231219-15.641209 49.304367l45.566861 272.377191c6.01585 36.0183-21.861853 65.252769-53.528262 65.252769-8.345391 0-16.972376-2.047949-25.317767-6.527837l-238.586035-128.611185a53.349066 53.349066 0 0 0-50.609935-0.076798l-238.662833 128.508787a52.990675 52.990675 0 0 1-25.343367 6.297443c-31.666408 0-59.697708-29.61846-53.681858-65.636759l45.720457-272.300393C513.207015 629.20667 460.98432 665.58336 460.98432 665.58336c-2.150346-0.742381-21.503462-1.049574-38.911027 12.0317L281.7888 767.9808c-7.60301 5.683058-42.955726 25.59936-51.19872 25.59936-21.247469 0-26.060148-26.674533-25.59936-51.19872v-179.19552c0.255994-13.516462-12.79968-26.879328-23.705007-34.661533L17.040219 411.074523c-27.442514-19.634709-20.453889-62.692833 11.852504-72.830179l193.326366-60.82408c12.825279-4.0191 22.911427-14.335642 26.956127-27.263318l61.156871-195.041524c5.887853-18.713132 22.527437-29.695258 39.269418-29.695258 12.364491 0 24.754581 4.0191 32.946376 15.794806l115.683508 163.17032c7.577411 10.854129 19.916302 11.18692 33.099973 11.186921h0.588785l108.822879 4.556686c-8.089398 15.718007-22.885828 32.767181-40.088597 35.327117l-148.450689 15.9996L358.58688 127.9968l-34.866328 147.477913c3.19992-10.137347-12.441289 58.648134-78.692433 79.460414L102.59328 383.9904l123.337717 78.103648c32.511187 23.244219 56.625784 60.440089 55.857803 101.091872v127.9968l94.180046-78.948426C419.052569 579.902302 492.727527 589.322867 460.98432 588.78528l-153.59616-153.59616c16.40919 16.40919-64.663983-46.258044 25.59936-76.79808l179.19552-25.59936 76.79808-25.59936c28.594485-4.249494 76.081298-100.631084 51.19872-51.19872l120.675384-224.941576A53.60506 53.60506 0 0 1 809.596405 0c19.378716 0 38.757431 10.367741 48.715582 31.052024l119.318617 247.827404a54.449839 54.449839 0 0 0 40.907777 30.488838l266.796531 39.730207c44.568486 6.655834 62.360041 62.79523 30.079248 95.024824z m-308.088298-55.038624c-43.160521-6.425439-80.509987-34.584735-99.863104-74.826929l-97.866353-203.898903L691.37856 307.19232c10.39334-21.60586-51.19872 76.79808-51.19872 76.79808l-246.137846 37.835854 170.542936 149.884253 25.752956 113.277168C571.496757 767.929602 537.7824 947.176321 537.7824 947.176321l208.276393-129.148772c-18.482738 9.958151 8.575786-9.369366 61.899253-9.57416-58.80173 0.742381 39.474213-3.839904 63.128022 8.908577L1075.368961 921.576961l-51.19872-281.592961c3.251119 19.481113-15.154821-2.227144 43.698107-61.105672l157.256869-157.20567-217.799355-32.587985z"
                                                fill="#ffffff" p-id="4291"></path>
                                    </svg>
                                    <style>
                                        .svg2 {
                                            fill: #b197fc;
                                            height: 40px;
                                            width: 40px;
                                        }
                                    </style>
                                    </svg>
                                </div>
                                <div class="bottom">
                                    <span class="botm_ph" id="content_box4" style="text-align: center;"></span>
                                    <button onclick="editContent('content_box4')">编辑</button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div style="flex: 50%; display: flex;  margin-top:10px;">
                        <!-- 左上分区 -->
                        <div style="flex: 50%;">
                            <div class="carddiy1" style="margin-left: 35%;">
                                <div class="top" style="background-color: rgb(133, 171, 218);">
                                    <svg t="1710853784560" class="icon" viewBox="0 0 1332 1024" version="1.1"
                                         xmlns="http://www.w3.org/2000/svg" p-id="4290" width="30" height="30">
                                        <path
                                                d="M1315.41416 444.123297l-193.019175 192.916777c-12.825279 12.79968-18.661933 31.231219-15.641209 49.304367l45.566861 272.377191c6.01585 36.0183-21.861853 65.252769-53.528262 65.252769-8.345391 0-16.972376-2.047949-25.317767-6.527837l-238.586035-128.611185a53.349066 53.349066 0 0 0-50.609935-0.076798l-238.662833 128.508787a52.990675 52.990675 0 0 1-25.343367 6.297443c-31.666408 0-59.697708-29.61846-53.681858-65.636759l45.720457-272.300393C513.207015 629.20667 460.98432 665.58336 460.98432 665.58336c-2.150346-0.742381-21.503462-1.049574-38.911027 12.0317L281.7888 767.9808c-7.60301 5.683058-42.955726 25.59936-51.19872 25.59936-21.247469 0-26.060148-26.674533-25.59936-51.19872v-179.19552c0.255994-13.516462-12.79968-26.879328-23.705007-34.661533L17.040219 411.074523c-27.442514-19.634709-20.453889-62.692833 11.852504-72.830179l193.326366-60.82408c12.825279-4.0191 22.911427-14.335642 26.956127-27.263318l61.156871-195.041524c5.887853-18.713132 22.527437-29.695258 39.269418-29.695258 12.364491 0 24.754581 4.0191 32.946376 15.794806l115.683508 163.17032c7.577411 10.854129 19.916302 11.18692 33.099973 11.186921h0.588785l108.822879 4.556686c-8.089398 15.718007-22.885828 32.767181-40.088597 35.327117l-148.450689 15.9996L358.58688 127.9968l-34.866328 147.477913c3.19992-10.137347-12.441289 58.648134-78.692433 79.460414L102.59328 383.9904l123.337717 78.103648c32.511187 23.244219 56.625784 60.440089 55.857803 101.091872v127.9968l94.180046-78.948426C419.052569 579.902302 492.727527 589.322867 460.98432 588.78528l-153.59616-153.59616c16.40919 16.40919-64.663983-46.258044 25.59936-76.79808l179.19552-25.59936 76.79808-25.59936c28.594485-4.249494 76.081298-100.631084 51.19872-51.19872l120.675384-224.941576A53.60506 53.60506 0 0 1 809.596405 0c19.378716 0 38.757431 10.367741 48.715582 31.052024l119.318617 247.827404a54.449839 54.449839 0 0 0 40.907777 30.488838l266.796531 39.730207c44.568486 6.655834 62.360041 62.79523 30.079248 95.024824z m-308.088298-55.038624c-43.160521-6.425439-80.509987-34.584735-99.863104-74.826929l-97.866353-203.898903L691.37856 307.19232c10.39334-21.60586-51.19872 76.79808-51.19872 76.79808l-246.137846 37.835854 170.542936 149.884253 25.752956 113.277168C571.496757 767.929602 537.7824 947.176321 537.7824 947.176321l208.276393-129.148772c-18.482738 9.958151 8.575786-9.369366 61.899253-9.57416-58.80173 0.742381 39.474213-3.839904 63.128022 8.908577L1075.368961 921.576961l-51.19872-281.592961c3.251119 19.481113-15.154821-2.227144 43.698107-61.105672l157.256869-157.20567-217.799355-32.587985z"
                                                fill="#ffffff" p-id="4291"></path>
                                    </svg>
                                    <style>
                                        .svg2 {
                                            fill: #b197fc;
                                            height: 40px;
                                            width: 40px;
                                        }
                                    </style>
                                    </svg>
                                </div>
                                <div class="bottom">
                                    <span class="botm_ph" id="content_box5" style="text-align: center;"></span>
                                    <button onclick="editContent('content_box5')" class="edit">编辑</button>
                                </div>
                            </div>
                        </div>
                        <!-- 右上分区 -->
                        <div style="flex: 50%;">
                            <div class="carddiy1" style="margin-left: 5%">
                                <div class="top" style="background-color: rgb(133, 171, 218);">
                                    <svg t="1710853784560" class="icon" viewBox="0 0 1332 1024" version="1.1"
                                         xmlns="http://www.w3.org/2000/svg" p-id="4290" width="30" height="30">
                                        <path
                                                d="M1315.41416 444.123297l-193.019175 192.916777c-12.825279 12.79968-18.661933 31.231219-15.641209 49.304367l45.566861 272.377191c6.01585 36.0183-21.861853 65.252769-53.528262 65.252769-8.345391 0-16.972376-2.047949-25.317767-6.527837l-238.586035-128.611185a53.349066 53.349066 0 0 0-50.609935-0.076798l-238.662833 128.508787a52.990675 52.990675 0 0 1-25.343367 6.297443c-31.666408 0-59.697708-29.61846-53.681858-65.636759l45.720457-272.300393C513.207015 629.20667 460.98432 665.58336 460.98432 665.58336c-2.150346-0.742381-21.503462-1.049574-38.911027 12.0317L281.7888 767.9808c-7.60301 5.683058-42.955726 25.59936-51.19872 25.59936-21.247469 0-26.060148-26.674533-25.59936-51.19872v-179.19552c0.255994-13.516462-12.79968-26.879328-23.705007-34.661533L17.040219 411.074523c-27.442514-19.634709-20.453889-62.692833 11.852504-72.830179l193.326366-60.82408c12.825279-4.0191 22.911427-14.335642 26.956127-27.263318l61.156871-195.041524c5.887853-18.713132 22.527437-29.695258 39.269418-29.695258 12.364491 0 24.754581 4.0191 32.946376 15.794806l115.683508 163.17032c7.577411 10.854129 19.916302 11.18692 33.099973 11.186921h0.588785l108.822879 4.556686c-8.089398 15.718007-22.885828 32.767181-40.088597 35.327117l-148.450689 15.9996L358.58688 127.9968l-34.866328 147.477913c3.19992-10.137347-12.441289 58.648134-78.692433 79.460414L102.59328 383.9904l123.337717 78.103648c32.511187 23.244219 56.625784 60.440089 55.857803 101.091872v127.9968l94.180046-78.948426C419.052569 579.902302 492.727527 589.322867 460.98432 588.78528l-153.59616-153.59616c16.40919 16.40919-64.663983-46.258044 25.59936-76.79808l179.19552-25.59936 76.79808-25.59936c28.594485-4.249494 76.081298-100.631084 51.19872-51.19872l120.675384-224.941576A53.60506 53.60506 0 0 1 809.596405 0c19.378716 0 38.757431 10.367741 48.715582 31.052024l119.318617 247.827404a54.449839 54.449839 0 0 0 40.907777 30.488838l266.796531 39.730207c44.568486 6.655834 62.360041 62.79523 30.079248 95.024824z m-308.088298-55.038624c-43.160521-6.425439-80.509987-34.584735-99.863104-74.826929l-97.866353-203.898903L691.37856 307.19232c10.39334-21.60586-51.19872 76.79808-51.19872 76.79808l-246.137846 37.835854 170.542936 149.884253 25.752956 113.277168C571.496757 767.929602 537.7824 947.176321 537.7824 947.176321l208.276393-129.148772c-18.482738 9.958151 8.575786-9.369366 61.899253-9.57416-58.80173 0.742381 39.474213-3.839904 63.128022 8.908577L1075.368961 921.576961l-51.19872-281.592961c3.251119 19.481113-15.154821-2.227144 43.698107-61.105672l157.256869-157.20567-217.799355-32.587985z"
                                                fill="#ffffff" p-id="4291"></path>
                                    </svg>
                                    <style>
                                        .svg2 {
                                            fill: #b197fc;
                                            height: 40px;
                                            width: 40px;
                                        }
                                    </style>
                                    </svg>
                                </div>
                                <div class="bottom">
                                    <span class="botm_ph" id="content_box6" style="text-align: center;"></span>

                                    <button onclick="editContent('content_box6')" class="edit">编辑</button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div style="flex: 50%; display: flex;  margin-top:10px;">
                        <!-- 左上分区 -->
                        <div style="flex: 50%;height: 100px;display: flex;align-items: center;justify-content: center;">
                            <div class="carddiy1">
                                <div class="top" style="background-color: rgb(133, 171, 218);">
                                    <svg t="1710853784560" class="icon" viewBox="0 0 1332 1024" version="1.1"
                                         xmlns="http://www.w3.org/2000/svg" p-id="4290" width="30" height="30">
                                        <path
                                                d="M1315.41416 444.123297l-193.019175 192.916777c-12.825279 12.79968-18.661933 31.231219-15.641209 49.304367l45.566861 272.377191c6.01585 36.0183-21.861853 65.252769-53.528262 65.252769-8.345391 0-16.972376-2.047949-25.317767-6.527837l-238.586035-128.611185a53.349066 53.349066 0 0 0-50.609935-0.076798l-238.662833 128.508787a52.990675 52.990675 0 0 1-25.343367 6.297443c-31.666408 0-59.697708-29.61846-53.681858-65.636759l45.720457-272.300393C513.207015 629.20667 460.98432 665.58336 460.98432 665.58336c-2.150346-0.742381-21.503462-1.049574-38.911027 12.0317L281.7888 767.9808c-7.60301 5.683058-42.955726 25.59936-51.19872 25.59936-21.247469 0-26.060148-26.674533-25.59936-51.19872v-179.19552c0.255994-13.516462-12.79968-26.879328-23.705007-34.661533L17.040219 411.074523c-27.442514-19.634709-20.453889-62.692833 11.852504-72.830179l193.326366-60.82408c12.825279-4.0191 22.911427-14.335642 26.956127-27.263318l61.156871-195.041524c5.887853-18.713132 22.527437-29.695258 39.269418-29.695258 12.364491 0 24.754581 4.0191 32.946376 15.794806l115.683508 163.17032c7.577411 10.854129 19.916302 11.18692 33.099973 11.186921h0.588785l108.822879 4.556686c-8.089398 15.718007-22.885828 32.767181-40.088597 35.327117l-148.450689 15.9996L358.58688 127.9968l-34.866328 147.477913c3.19992-10.137347-12.441289 58.648134-78.692433 79.460414L102.59328 383.9904l123.337717 78.103648c32.511187 23.244219 56.625784 60.440089 55.857803 101.091872v127.9968l94.180046-78.948426C419.052569 579.902302 492.727527 589.322867 460.98432 588.78528l-153.59616-153.59616c16.40919 16.40919-64.663983-46.258044 25.59936-76.79808l179.19552-25.59936 76.79808-25.59936c28.594485-4.249494 76.081298-100.631084 51.19872-51.19872l120.675384-224.941576A53.60506 53.60506 0 0 1 809.596405 0c19.378716 0 38.757431 10.367741 48.715582 31.052024l119.318617 247.827404a54.449839 54.449839 0 0 0 40.907777 30.488838l266.796531 39.730207c44.568486 6.655834 62.360041 62.79523 30.079248 95.024824z m-308.088298-55.038624c-43.160521-6.425439-80.509987-34.584735-99.863104-74.826929l-97.866353-203.898903L691.37856 307.19232c10.39334-21.60586-51.19872 76.79808-51.19872 76.79808l-246.137846 37.835854 170.542936 149.884253 25.752956 113.277168C571.496757 767.929602 537.7824 947.176321 537.7824 947.176321l208.276393-129.148772c-18.482738 9.958151 8.575786-9.369366 61.899253-9.57416-58.80173 0.742381 39.474213-3.839904 63.128022 8.908577L1075.368961 921.576961l-51.19872-281.592961c3.251119 19.481113-15.154821-2.227144 43.698107-61.105672l157.256869-157.20567-217.799355-32.587985z"
                                                fill="#ffffff" p-id="4291"></path>
                                    </svg>
                                    <style>
                                        .svg2 {
                                            fill: #b197fc;
                                            height: 40px;
                                            width: 40px;
                                        }
                                    </style>
                                    </svg>
                                </div>
                                <div class="bottom">
                                    <span class="botm_ph" id="content_box7" style="text-align: center;"></span>

                                    <button onclick="editContent('content_box7')" class="edit">编辑</button>
                                </div>
                            </div>
                        </div>
                        <!-- 右上分区 -->
                    </div>
                    <div style="flex: 50%; display: flex;  margin-top:30px;">
                        <!-- 左上分区 -->
                        <div style="flex: 50%;height: 100px;">
                            <div class="carddiy" style="margin-left: 35%">
                                <div class="top" style="background-color: rgb(133, 171, 218);">
                                    <svg t="1710853784560" class="icon" viewBox="0 0 1332 1024" version="1.1"
                                         xmlns="http://www.w3.org/2000/svg" p-id="4290" width="30" height="30">
                                        <path
                                                d="M1315.41416 444.123297l-193.019175 192.916777c-12.825279 12.79968-18.661933 31.231219-15.641209 49.304367l45.566861 272.377191c6.01585 36.0183-21.861853 65.252769-53.528262 65.252769-8.345391 0-16.972376-2.047949-25.317767-6.527837l-238.586035-128.611185a53.349066 53.349066 0 0 0-50.609935-0.076798l-238.662833 128.508787a52.990675 52.990675 0 0 1-25.343367 6.297443c-31.666408 0-59.697708-29.61846-53.681858-65.636759l45.720457-272.300393C513.207015 629.20667 460.98432 665.58336 460.98432 665.58336c-2.150346-0.742381-21.503462-1.049574-38.911027 12.0317L281.7888 767.9808c-7.60301 5.683058-42.955726 25.59936-51.19872 25.59936-21.247469 0-26.060148-26.674533-25.59936-51.19872v-179.19552c0.255994-13.516462-12.79968-26.879328-23.705007-34.661533L17.040219 411.074523c-27.442514-19.634709-20.453889-62.692833 11.852504-72.830179l193.326366-60.82408c12.825279-4.0191 22.911427-14.335642 26.956127-27.263318l61.156871-195.041524c5.887853-18.713132 22.527437-29.695258 39.269418-29.695258 12.364491 0 24.754581 4.0191 32.946376 15.794806l115.683508 163.17032c7.577411 10.854129 19.916302 11.18692 33.099973 11.186921h0.588785l108.822879 4.556686c-8.089398 15.718007-22.885828 32.767181-40.088597 35.327117l-148.450689 15.9996L358.58688 127.9968l-34.866328 147.477913c3.19992-10.137347-12.441289 58.648134-78.692433 79.460414L102.59328 383.9904l123.337717 78.103648c32.511187 23.244219 56.625784 60.440089 55.857803 101.091872v127.9968l94.180046-78.948426C419.052569 579.902302 492.727527 589.322867 460.98432 588.78528l-153.59616-153.59616c16.40919 16.40919-64.663983-46.258044 25.59936-76.79808l179.19552-25.59936 76.79808-25.59936c28.594485-4.249494 76.081298-100.631084 51.19872-51.19872l120.675384-224.941576A53.60506 53.60506 0 0 1 809.596405 0c19.378716 0 38.757431 10.367741 48.715582 31.052024l119.318617 247.827404a54.449839 54.449839 0 0 0 40.907777 30.488838l266.796531 39.730207c44.568486 6.655834 62.360041 62.79523 30.079248 95.024824z m-308.088298-55.038624c-43.160521-6.425439-80.509987-34.584735-99.863104-74.826929l-97.866353-203.898903L691.37856 307.19232c10.39334-21.60586-51.19872 76.79808-51.19872 76.79808l-246.137846 37.835854 170.542936 149.884253 25.752956 113.277168C571.496757 767.929602 537.7824 947.176321 537.7824 947.176321l208.276393-129.148772c-18.482738 9.958151 8.575786-9.369366 61.899253-9.57416-58.80173 0.742381 39.474213-3.839904 63.128022 8.908577L1075.368961 921.576961l-51.19872-281.592961c3.251119 19.481113-15.154821-2.227144 43.698107-61.105672l157.256869-157.20567-217.799355-32.587985z"
                                                fill="#ffffff" p-id="4291"></path>
                                    </svg>
                                    <style>
                                        .svg2 {
                                            fill: #b197fc;
                                            height: 40px;
                                            width: 40px;
                                        }
                                    </style>
                                    </svg>
                                </div>
                                <div class="bottom" style="flex-direction: column;">
                                    <span class="botm_ph" id="content_box8" style="text-align: center;"></span>
                                    <button onclick="editContent('content_box8')" class="edit">编辑</button>
                                </div>
                            </div>
                        </div>
                        <!-- 右上分区 -->
                        <div style="flex: 50%;height: 100px">
                            <div class="carddiy" style="margin-left: 5%">
                                <div class="top" style="background-color: rgb(133, 171, 218);">
                                    <svg t="1710853784560" class="icon" viewBox="0 0 1332 1024" version="1.1"
                                         xmlns="http://www.w3.org/2000/svg" p-id="4290" width="30" height="30">
                                        <path
                                                d="M1315.41416 444.123297l-193.019175 192.916777c-12.825279 12.79968-18.661933 31.231219-15.641209 49.304367l45.566861 272.377191c6.01585 36.0183-21.861853 65.252769-53.528262 65.252769-8.345391 0-16.972376-2.047949-25.317767-6.527837l-238.586035-128.611185a53.349066 53.349066 0 0 0-50.609935-0.076798l-238.662833 128.508787a52.990675 52.990675 0 0 1-25.343367 6.297443c-31.666408 0-59.697708-29.61846-53.681858-65.636759l45.720457-272.300393C513.207015 629.20667 460.98432 665.58336 460.98432 665.58336c-2.150346-0.742381-21.503462-1.049574-38.911027 12.0317L281.7888 767.9808c-7.60301 5.683058-42.955726 25.59936-51.19872 25.59936-21.247469 0-26.060148-26.674533-25.59936-51.19872v-179.19552c0.255994-13.516462-12.79968-26.879328-23.705007-34.661533L17.040219 411.074523c-27.442514-19.634709-20.453889-62.692833 11.852504-72.830179l193.326366-60.82408c12.825279-4.0191 22.911427-14.335642 26.956127-27.263318l61.156871-195.041524c5.887853-18.713132 22.527437-29.695258 39.269418-29.695258 12.364491 0 24.754581 4.0191 32.946376 15.794806l115.683508 163.17032c7.577411 10.854129 19.916302 11.18692 33.099973 11.186921h0.588785l108.822879 4.556686c-8.089398 15.718007-22.885828 32.767181-40.088597 35.327117l-148.450689 15.9996L358.58688 127.9968l-34.866328 147.477913c3.19992-10.137347-12.441289 58.648134-78.692433 79.460414L102.59328 383.9904l123.337717 78.103648c32.511187 23.244219 56.625784 60.440089 55.857803 101.091872v127.9968l94.180046-78.948426C419.052569 579.902302 492.727527 589.322867 460.98432 588.78528l-153.59616-153.59616c16.40919 16.40919-64.663983-46.258044 25.59936-76.79808l179.19552-25.59936 76.79808-25.59936c28.594485-4.249494 76.081298-100.631084 51.19872-51.19872l120.675384-224.941576A53.60506 53.60506 0 0 1 809.596405 0c19.378716 0 38.757431 10.367741 48.715582 31.052024l119.318617 247.827404a54.449839 54.449839 0 0 0 40.907777 30.488838l266.796531 39.730207c44.568486 6.655834 62.360041 62.79523 30.079248 95.024824z m-308.088298-55.038624c-43.160521-6.425439-80.509987-34.584735-99.863104-74.826929l-97.866353-203.898903L691.37856 307.19232c10.39334-21.60586-51.19872 76.79808-51.19872 76.79808l-246.137846 37.835854 170.542936 149.884253 25.752956 113.277168C571.496757 767.929602 537.7824 947.176321 537.7824 947.176321l208.276393-129.148772c-18.482738 9.958151 8.575786-9.369366 61.899253-9.57416-58.80173 0.742381 39.474213-3.839904 63.128022 8.908577L1075.368961 921.576961l-51.19872-281.592961c3.251119 19.481113-15.154821-2.227144 43.698107-61.105672l157.256869-157.20567-217.799355-32.587985z"
                                                fill="#ffffff" p-id="4291"></path>
                                    </svg>
                                    <style>
                                        .svg2 {
                                            fill: #b197fc;
                                            height: 40px;
                                            width: 40px;
                                        }
                                    </style>
                                    </svg>
                                </div>
                                <div class="bottom" style="flex-direction: column;">
                                    <span class="botm_ph" id="content_box9" style="text-align: center;"></span>
                                    <button onclick="editContent('content_box9')" class="edit">编辑</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

{% endblock %}

文心一言的调用:

def ask(request):
    erniebot.api_type = 'aistudio'
    erniebot.access_token = "yours_token"

    model = 'ernie-3.5'
    messages = [{'role': 'user', 'content': "人生在世,人们大多喜欢“得”,不喜欢“失”。但现实是,得与失如影随形,有得的地方必定有失, 有失的地方也必定有得。在对得与失的纠结中,我们常常忽略一个基本的常识,那就是 无论得失,皆是过程。\
    “是非成败转头空。青山依旧在,几度夕阳红。”历代的帝王,都觉得自己得到了江山,得到了至高无上的权力,殊不知这些都是会失去的。历史就在这一代又一代得与失的更迭中不断前进,这才有了如今的盛世。而这无数的得与失,其实都是人类文明发展链上的锁扣。所以,得时,不要扬扬得意,忘乎所以:失时,也不要顾影自怜,自怨自艾。我们应该如凡高那般,抱着“一个人绝不可以让自已心灵里的火熄灭掉,而要让它始终不断地燃烧”的信念,让心中的那把火,永远燃烧着!\
    “往者不可谏,来者犹可追。”不汲汲于得,不戚戚于失,因为无论得失,皆是过程。在过程中行走,在过程中反思,在过程中突破,才是人生的真谛。"}]
    response = erniebot.ChatCompletion.create(
        model=model,
        messages=messages,
        system='你是一个评阅作文的老师,请对每一个提问都进行以下评分(满分都是100):\
        基础评分(拼写、语法正确度)、文字优美度评分、结构清晰度评分、贴题度评分、观点深度评分、论据合理性评分,\
        最终整合成一个最终评分。并给出50字左右的评语,和50字的改进建议,以json的格式输出。\
        以下为例的格式输出:[{ \"基础评分\": \"\"}, {\"文字优美度评分\": \"\"},{\"结构清晰度评分\": \"\"},{\"贴题度评分\": \"\"},{\"观点深度评分\": \"\"},{\"论据合理性评分\": \"\"},{\"最终整合成的最终评分\": \"\"},{\"评语\": \"\"},{\"改进建议\": \"\"}]'
    )

    answer=response.result
    print(answer)

前端发起fetch请求(自我感觉有点石山):

var jsonData
        function submitQuestion(buttonElement, type) {
            if (type === 'review') {
                buttonElement.innerText = '正在评阅中...'

                buttonElement.disabled = true;
            } else if (type === 'export') {
                buttonElement.innerText = '正在导出中...'
                buttonElement.disabled = true;
            }

            fetch(`/ask/`)
                .then(response => response.json())
                .then(data => {
                    document.getElementById('infos').style.display = 'block'
                    if (type === 'review') {

                        const moduleContents = [];
                        let moduleContent1 = data[0]["基础评分"];
                        moduleContents.push(moduleContent1);
                        document.getElementById(`content_box1`).innerHTML = `基础评分: ${moduleContent1}`;

                        let moduleContent2 = data[1]["文字优美度评分"];
                        moduleContents.push(moduleContent2);
                        document.getElementById(`content_box2`).innerHTML = `文字优美度评分: ${moduleContent2}`;

                        let moduleContent3 = data[2]["结构清晰度评分"];
                        moduleContents.push(moduleContent3);
                        document.getElementById(`content_box3`).innerHTML = `结构清晰度评分: ${moduleContent3}`;

                        let moduleContent4 = data[3]["贴题度评分"];
                        moduleContents.push(moduleContent4);
                        document.getElementById(`content_box4`).innerHTML = `贴题度评分: ${moduleContent4}`;

                        let moduleContent5 = data[4]["观点深度评分"];
                        moduleContents.push(moduleContent5);
                        document.getElementById(`content_box5`).innerHTML = `观点深度评分: ${moduleContent5}`;

                        let moduleContent6 = data[5]["论据合理性评分"];
                        moduleContents.push(moduleContent6);
                        document.getElementById(`content_box6`).innerHTML = `论据合理性评分: ${moduleContent6}`;

                        let moduleContent7 = data[6]["最终整合成的最终评分"];
                        moduleContents.push(moduleContent7);
                        document.getElementById(`content_box7`).innerHTML = `最终整合成的最终评分: ${moduleContent7}`;

                        let moduleContent8 = data[7]["评语"];
                        moduleContents.push(moduleContent8);
                        console.log(document.getElementById(`content_box8`))
                        document.getElementById(`content_box8`).innerText = `评语: ${moduleContent8}`;
                        let moduleContent9 = data[8]["改进建议"];
                        moduleContents.push(moduleContent9);
                        document.getElementById(`content_box9`).innerText = `改进建议: ${moduleContent9}`;

                    }
                    jsonData = data
                })

                .catch((error) => {
                    console.error('Error:', error);
                })

                .finally(() => {
                    if (type === 'review') {
                        buttonElement.innerText = '开始评阅';
                        buttonElement.disabled = false;
                    } else if (type === 'export') {
                        buttonElement.innerText = '开始导出';
                        buttonElement.disabled = false;
                    }
                });

后端大模型的处理逻辑(同样感觉有点石山): 

    try:
        json_start=answer.find("[")
        json_end=answer.rfind("]")
        if json_start != -1 and json_end != -1:
            json_content=answer[json_start:json_end+1]
            answer_dict=json.loads(json_content)
        else:
            answer_dict={}
    except json.JSONDecodeError:
        answer_dict={}

    print(answer_dict)

    module_titles=[]

    for item in answer_dict:
        module_discription=item.get("基础评分","")
        if module_discription:
            module_titles.append({"基础评分":module_discription})

        module_discription = item.get("文字优美度评分", "")
        if module_discription:
            module_titles.append({"文字优美度评分": module_discription})

        module_discription = item.get("结构清晰度评分", "")
        if module_discription:
            module_titles.append({"结构清晰度评分": module_discription})

        module_discription = item.get("贴题度评分", "")
        if module_discription:
            module_titles.append({"贴题度评分": module_discription})

        module_discription = item.get("观点深度评分", "")
        if module_discription:
            module_titles.append({"观点深度评分": module_discription})

        module_discription = item.get("论据合理性评分", "")
        if module_discription:
            module_titles.append({"论据合理性评分": module_discription})

        module_discription = item.get("最终整合成的最终评分", "")
        if module_discription:
            module_titles.append({"最终整合成的最终评分": module_discription})

        module_discription = item.get("评语", "")
        if module_discription:
            module_titles.append({"评语": module_discription})

        module_discription = item.get("改进建议", "")
        if module_discription:
            module_titles.append({"改进建议": module_discription})

    print(module_titles)

    return JsonResponse(module_titles,safe=False)

 页面demo:

此外还有个分数导出的功能,个人觉得很有意思

if (type === 'export') {

                let str = `基础评分\n文字优美度评分\n结构清晰度评分\n贴题度评分\n观点深度评分\n论据合理性评分\n最终整合成的最终评分\n评语\n改进建议\n`;
                for (let i = 0; i < jsonData.length; i++) {
                    for (const key in jsonData[i]) {
                        str += `${jsonData[i][key] + '\t'},`;
                    }
                    str += '\n';
                }
                const uri = 'data:text/csv;charset=utf-8,\ufeff' + encodeURIComponent(str);
                const link = document.createElement("a");
                link.href = uri;
                link.download = "评阅结果数据表.csv";
                link.click();
            }

 页面demo:

 上面这些代码都是自己琢磨探索肝出来的,感觉很有成就感,值得纪念一下。其余还有三个管理功能,crud,大伙跟着武沛齐老师干吧!

参赛感悟

出于好奇心和兴趣使然,这个Web从零开始,边学边写,大概做了两个月。这个学习历程还是挺有感触的。

先说下自己,从小我就觉得那些开发网站的团队很酷,本科阶段也想做一个属于自己的东西。所以借着服创这个机会,我试着去做了一个改作文的平台。起初我以为这种开发跟平时上课学的差不多,搞懂之后就可以举一反三,就可以做出任何想要的东西,但是做着做着就发现不对劲,新的需求需要新的技术,不可能学一遍就学会的。这次经历宝贵就宝贵在让我明白了一个道理,技术没边境,真的是一山更比一山高,真也应了那句话,人总以为自己没走过的路上开满了鲜花,经历过了才发觉原来巅峰这个名词,意思是一直向上爬的这种状态,而不是天花板的那种不动的状态。

再说下比赛,我们这个比赛最后的结果其实是不满意的,主要还是我们自身出了问题。首先就是我们选题是作文批阅,这种批阅其实有很多的主观因素干扰,当时我们这个项目也投了江苏省计算机设计大赛,当时省赛答辩的老师就问,你们这个大模型评分和传统的老师评分,从分数上差别有多少?学生是否能接受大模型评分?一连串问题直接把我们干懵了,这确实也是我们项目的漏洞所在,也是我们考虑不周的地方。

其次就是成绩统计那块没有写入数据库,是黑盒mock的(有点尴尬),然后被服创专家点出来了,导致比赛寄了/(ㄒoㄒ)/~~。但是我觉得我们相比计设那些不知道多少年的老项目要有勇气,比那些服创跟着学长混自己写ppt计划书拿奖的人,我学了更多的东西有了更多的感悟,虽然可能看着没什么感觉,但这是你们混再多比赛都感悟不到的。

不过有一说一,今年凡是队伍里有学长的(提前学过开发或有丰富的参赛经验),最后结果都很可观,我们队伍是五个纯小白,第一次参赛,没啥经验也是从零开始,确实要劣势一些。不过起码我们团队一直做下来了没松懈,同时也学了好多东西,我觉得这是比拿再高的奖都重要的东西。

下面是一些花絮:

当时去上海玩,晚上队长让赶计划书,于是找了个电竞酒店哈哈哈

 连云港省赛答辩

就让这个demo见证下这段宝贵但失败的岁月。

基于LLM和OCR的智能阅卷平台

  • 13
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值