<!--<html>-->
<!-- <head>-->
<!--     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>-->
<!--     <title>Flask HTTP请求方法处理</title>-->
<!-- </head>-->
<!--    <body>-->
<!--       <form action = "http://localhost:5000/login" method = "post">-->
<!--          <p>请输入内容:</p>-->
<!--          <p><input type = "text" name = "name_text" value=""/></p>-->
<!--          <p><input type = "submit" value = "提交" /></p>-->
<!--       </form>-->
<!--    </body>-->
<!-- </html>-->


<!--&lt;!&ndash; 声明文档类型为HTML5,告诉浏览器用HTML5标准解析页面 &ndash;&gt;-->
<!--<!DOCTYPE html>-->
<!--<html>-->
<!--<head>-->
<!--    &lt;!&ndash; 元数据标签:设置文档字符编码为UTF-8,确保中文等字符正常显示 &ndash;&gt;-->
<!--    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>-->
<!--    &lt;!&ndash; 设置网页标题,会显示在浏览器标签页上 &ndash;&gt;-->
<!--    <title>Flask HTTP请求方法处理</title>-->
<!--    &lt;!&ndash; 样式表部分:定义页面元素的外观 &ndash;&gt;-->
<!--    <style>-->
<!--        /* 容器样式:设置最大宽度、居中显示、内外边距和字体 */-->
<!--        .container {-->
<!--            max-width: 600px; /* 最大宽度600px,超过后不再变大 */-->
<!--            margin: 20px auto; /* 上下边距20px,左右自动居中 */-->
<!--            padding: 20px; /* 内边距20px,内容与边框有距离 */-->
<!--            font-family: Arial, sans-serif; /* 字体为Arial或默认无衬线字体 */-->
<!--        }-->
<!--        /* 表单组样式:设置表单元素组的底部间距 */-->
<!--        .form-group {-->
<!--            margin-bottom: 15px; /* 底部外边距15px,与下一个元素保持距离 */-->
<!--        }-->
<!--        /* 标签样式:设置标签为块级元素并添加底部间距和粗体 */-->
<!--        label {-->
<!--            display: block; /* 块级显示,独占一行 */-->
<!--            margin-bottom: 5px; /* 底部外边距5px,与输入框保持距离 */-->
<!--            font-weight: bold; /* 字体加粗 */-->
<!--        }-->
<!--        /* 文本输入框和文本域样式:设置宽度、内边距、边框等 */-->
<!--        input[type="text"], textarea {-->
<!--            width: 100%; /* 宽度占满父容器 */-->
<!--            padding: 8px; /* 内边距8px,内容不贴边 */-->
<!--            box-sizing: border-box; /* 盒模型计算方式:width包含边框和内边距 */-->
<!--            border: 1px solid #ccc; /* 边框1px实线,颜色为浅灰色 */-->
<!--            border-radius: 4px; /* 边框圆角4px */-->
<!--        }-->
<!--        /* 文本域样式:设置高度和可垂直调整大小 */-->
<!--        textarea {-->
<!--            height: 150px; /* 高度150px */-->
<!--            resize: vertical; /* 仅允许垂直方向调整大小 */-->
<!--        }-->
<!--        /* 提交按钮样式:设置背景色、文字色、内边距等 */-->
<!--        input[type="submit"] {-->
<!--            background-color: #4CAF50; /* 背景色为绿色 */-->
<!--            color: white; /* 文字色为白色 */-->
<!--            padding: 10px 15px; /* 内边距上下10px、左右15px */-->
<!--            border: none; /* 无边框 */-->
<!--            border-radius: 4px; /* 边框圆角4px */-->
<!--            cursor: pointer; /* 鼠标悬停时显示手型光标 */-->
<!--        }-->
<!--        /* 提交按钮 hover状态样式:鼠标悬停时背景色变深 */-->
<!--        input[type="submit"]:hover {-->
<!--            background-color: #45a049; /* 背景色稍深的绿色 */-->
<!--        }-->
<!--        /* 响应区域样式:设置顶部间距、上边框 */-->
<!--        .response-section {-->
<!--            margin-top: 30px; /* 顶部外边距30px,与表单保持距离 */-->
<!--            padding-top: 15px; /* 顶部内边距15px,内容与边框有距离 */-->
<!--            border-top: 1px solid #eee; /* 顶部边框1px实线,颜色为浅灰色 */-->
<!--        }-->
<!--    </style>-->
<!--</head>-->
<!--<body>-->
<!--    &lt;!&ndash; 主容器:包裹所有内容,应用上面定义的.container样式 &ndash;&gt;-->
<!--    <div class="container">-->

<!--             &lt;!&ndash; 响应展示区域:用于显示后端返回的内容 &ndash;&gt;-->
<!--        <div class="response-section">-->
<!--            &lt;!&ndash; 响应区域的标签 &ndash;&gt;-->
<!--            <label for="response">后端返回内容:</label>-->
<!--            &lt;!&ndash; 文本域:readonly表示只读,初始显示"等待提交请求..." &ndash;&gt;-->
<!--            <textarea id="response" readonly>等待提交请求...</textarea>-->
<!--        </div>-->


<!--        &lt;!&ndash; 表单:id为mainForm,用于JavaScript获取表单元素 &ndash;&gt;-->
<!--        <form action = "http://localhost:5000/login" method = "post">-->
<!--            &lt;!&ndash; 表单组1:包含输入框的标签和输入框 &ndash;&gt;-->
<!--            <div class="form-group">-->
<!--                &lt;!&ndash; 标签:for属性与输入框id关联,点击标签会聚焦到输入框 &ndash;&gt;-->
<!--                <label for="name_text_input">请输入内容:</label>-->
<!--                &lt;!&ndash; 文本输入框:id和name用于标识,value初始为空 &ndash;&gt;-->
<!--                <input type="text" id="name_text_input" name="name_text" value=""/>-->
<!--            </div>-->
<!--            &lt;!&ndash; 表单组2:包含提交按钮 &ndash;&gt;-->
<!--            <div class="form-group">-->
<!--                &lt;!&ndash; 提交按钮:点击会触发表单提交事件 &ndash;&gt;-->
<!--                <input type="submit" value="提交" />-->
<!--            </div>-->
<!--        </form>-->


<!--    </div>-->


<!--</body>-->
<!--</html>-->



<!--<!DOCTYPE html>-->
<!--<html lang="zh">-->
<!--<head>-->
<!--    <meta charset="UTF-8">-->
<!--    <title>登录页面</title>-->
<!--    <style>-->
<!--        body {-->
<!--            font-family: Arial, sans-serif;-->
<!--            margin: 40px;-->
<!--        }-->
<!--        .form-section, .response-section {-->
<!--            margin-bottom: 20px;-->
<!--        }-->
<!--        label {-->
<!--            display: block;-->
<!--            margin-bottom: 5px;-->
<!--            font-weight: bold;-->
<!--        }-->
<!--        input[type="text"], textarea {-->
<!--            width: 300px;-->
<!--            padding: 8px;-->
<!--            font-size: 16px;-->
<!--        }-->
<!--        textarea {-->
<!--            height: 100px;-->
<!--            resize: none;-->
<!--        }-->
<!--        input[type="submit"] {-->
<!--            padding: 10px 20px;-->
<!--            font-size: 16px;-->
<!--            margin-top: 10px;-->
<!--        }-->
<!--    </style>-->
<!--</head>-->
<!--<body>-->

<!--    &lt;!&ndash; 表单提交区域 &ndash;&gt;-->
<!--    <div class="form-section">-->
<!--        <form action="/login" method="post">-->
<!--            <label for="name_text">用户名:</label>-->
<!--            <input type="text" id="name_text" name="name_text" required />-->
<!--            <input type="submit" value="提交" />-->
<!--        </form>-->
<!--    </div>-->

<!--    &lt;!&ndash; 响应展示区域:用于显示后端返回的内容 &ndash;&gt;-->
<!--    <div class="response-section">-->
<!--        <label for="response">后端返回内容:</label>-->
<!--        &lt;!&ndash; 使用模板变量 {{ response }} 显示后端返回内容 &ndash;&gt;-->
<!--        <textarea id="response" readonly>{{ response }}</textarea>-->
<!--    </div>-->

<!--</body>-->
<!--</html>-->


<!--<!DOCTYPE html>-->
<!--<html lang="zh">-->
<!--<head>-->
<!--    <meta charset="UTF-8">-->
<!--    <title>登录页面</title>-->
<!--    <style>-->
<!--        body {-->
<!--            font-family: Arial, sans-serif;-->
<!--            margin: 40px;-->
<!--        }-->
<!--        .form-section, .response-section {-->
<!--            margin-bottom: 20px;-->
<!--        }-->
<!--        label {-->
<!--            display: block;-->
<!--            margin-bottom: 5px;-->
<!--            font-weight: bold;-->
<!--        }-->
<!--        input[type="text"], textarea {-->
<!--            width: 300px;-->
<!--            padding: 8px;-->
<!--            font-size: 16px;-->
<!--        }-->
<!--        textarea {-->
<!--            height: 100px;-->
<!--            resize: none;-->
<!--        }-->
<!--        input[type="submit"] {-->
<!--            padding: 10px 20px;-->
<!--            font-size: 16px;-->
<!--            margin-top: 10px;-->
<!--            cursor: pointer;-->
<!--        }-->
<!--    </style>-->
<!--</head>-->
<!--<body>-->

<!--    &lt;!&ndash; 表单提交区域 &ndash;&gt;-->
<!--    <div class="form-section">-->
<!--        <form action="/login" method="post">-->
<!--            <label for="name_text">用户名:</label>-->
<!--            <input type="text" id="name_text" name="name_text" required />-->
<!--            <input type="submit" value="提交" />-->
<!--        </form>-->
<!--    </div>-->

<!--    &lt;!&ndash; 响应展示区域:用于显示后端返回的内容 &ndash;&gt;-->
<!--    <div class="response-section">-->
<!--        <label for="response">后端返回内容:</label>-->
<!--        &lt;!&ndash; 使用模板变量 {{ response }} 显示后端返回内容 &ndash;&gt;-->
<!--        <textarea id="response" readonly>{{ response }}</textarea>-->
<!--    </div>-->

<!--    <script>-->
<!--        // 页面加载完成后处理响应内容-->
<!--        document.addEventListener('DOMContentLoaded', function() {-->
<!--            const responseTextarea = document.getElementById('response');-->
<!--            // 如果内容是模板变量本身或为空,就清空显示-->
<!--            if (responseTextarea.value === '{{ response }}' || responseTextarea.value.trim() === '') {-->
<!--                responseTextarea.value = '';-->
<!--            }-->
<!--        });-->
<!--    </script>-->

<!--</body>-->
<!--</html>-->




<!--<!DOCTYPE html>-->
<!--<html lang="zh">-->
<!--<head>-->
<!--    <meta charset="UTF-8">-->
<!--    <title>登录页面</title>-->
<!--    <style>-->
<!--        body { font-family: Arial, sans-serif; margin: 40px; }-->
<!--        .form-section, .response-section { margin-bottom: 20px; }-->
<!--        label { display: block; margin-bottom: 5px; font-weight: bold; }-->
<!--        input[type="text"], textarea {-->
<!--            width: 300px; padding: 8px; font-size: 16px;-->
<!--        }-->
<!--        textarea { height: 100px; resize: none; }-->
<!--        input[type="submit"] {-->
<!--            padding: 10px 20px; font-size: 16px; margin-top: 10px;-->
<!--        }-->
<!--    </style>-->
<!--</head>-->
<!--<body>-->
<!--    &lt;!&ndash; 表单提交区域 &ndash;&gt;-->
<!--    <div class="form-section">-->
<!--        <form action="/login" method="post">-->
<!--            <label for="name_text">用户名:</label>-->
<!--            <input type="text" id="name_text" name="name_text" required />-->
<!--            <input type="submit" value="提交" />-->
<!--        </form>-->
<!--    </div>-->

<!--    &lt;!&ndash; 响应展示区域:显示后端返回内容 &ndash;&gt;-->
<!--    <div class="response-section">-->
<!--        <label for="response">后端返回内容:</label>-->
<!--        &lt;!&ndash; Flask 模板变量,由后端渲染替换 &ndash;&gt;-->
<!--        <textarea id="response" readonly>{{ response }}</textarea>-->
<!--    </div>-->





<!--    <script>-->
<!--        // 页面加载完成后处理响应内容-->
<!--        document.addEventListener('DOMContentLoaded', function() {-->
<!--            const responseTextarea = document.getElementById('response');-->
<!--            // 如果内容是模板变量本身或为空,就清空显示-->
<!--            if (responseTextarea.value === '{{ response }}' || responseTextarea.value.trim() === '') {-->
<!--                responseTextarea.value = '';-->
<!--            }-->
<!--        });-->
<!--    </script>-->




<!--</body>-->
<!--</html>-->




<!--<!DOCTYPE html>-->
<!--<html lang="zh">-->
<!--<head>-->
<!--    <meta charset="UTF-8">-->
<!--    <title>对话页面</title>-->
<!--    <style>-->
<!--        body { font-family: Arial, sans-serif; margin: 40px; max-width: 800px; }-->
<!--        .form-section, .response-section, .history-section { margin-bottom: 20px; padding: 15px; border: 1px solid #eee; border-radius: 5px; }-->
<!--        label { display: block; margin-bottom: 5px; font-weight: bold; }-->
<!--        input[type="text"], textarea {-->
<!--            width: 100%; padding: 8px; font-size: 16px; box-sizing: border-box;-->
<!--        }-->
<!--        textarea { height: 100px; resize: none; }-->
<!--        input[type="submit"] {-->
<!--            padding: 10px 20px; font-size: 16px; margin-top: 10px; cursor: pointer;-->
<!--            background-color: #4CAF50; color: white; border: none; border-radius: 4px;-->
<!--        }-->
<!--        input[type="submit"]:hover { background-color: #45a049; }-->
<!--        .history-message { margin: 10px 0; padding: 8px; border-radius: 4px; }-->
<!--        .user-message { background-color: #e3f2fd; }-->
<!--        .bot-message { background-color: #f5f5f5; }-->
<!--        .message-role { font-weight: bold; margin-bottom: 5px; }-->
<!--    </style>-->
<!--</head>-->
<!--<body>-->
<!--    &lt;!&ndash; 对话历史区域 &ndash;&gt;-->
<!--    <div class="history-section">-->
<!--        <label>对话历史:</label>-->
<!--        {% if history %}-->
<!--            {% for message in history %}-->
<!--                <div class="history-message {{ 'user-message' if message.role == 'user' else 'bot-message' }}">-->
<!--                    <div class="message-role">{{ '你' if message.role == 'user' else 'AI' }}:</div>-->
<!--                    <div class="message-content">{{ message.content }}</div>-->
<!--                </div>-->
<!--            {% endfor %}-->
<!--        {% else %}-->
<!--            <p>暂无对话历史</p>-->
<!--        {% endif %}-->
<!--    </div>-->

<!--    &lt;!&ndash; 表单提交区域 &ndash;&gt;-->
<!--    <div class="form-section">-->
<!--        <form action="/login" method="post">-->
<!--            <label for="name_text">输入消息:</label>-->
<!--            <input type="text" id="name_text" name="name_text" required />-->
<!--            <input type="submit" value="发送" />-->
<!--        </form>-->
<!--    </div>-->

<!--    &lt;!&ndash; 最新响应展示区域 &ndash;&gt;-->
<!--    <div class="response-section">-->
<!--        <label for="response">最新回复:</label>-->
<!--        <textarea id="response" readonly>{{ response }}</textarea>-->
<!--    </div>-->

<!--    <script>-->
<!--        // 页面加载完成后处理响应内容-->
<!--        document.addEventListener('DOMContentLoaded', function() {-->
<!--            const responseTextarea = document.getElementById('response');-->
<!--            // 如果内容是模板变量本身或为空,就清空显示-->
<!--            if (responseTextarea.value === '{{ response }}' || responseTextarea.value.trim() === '') {-->
<!--                responseTextarea.value = '';-->
<!--            }-->

<!--            // 自动聚焦到输入框-->
<!--            document.getElementById('name_text').focus();-->
<!--        });-->
<!--    </script>-->
<!--</body>-->
<!--</html>-->

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐