1972 lines
59 KiB
HTML
1972 lines
59 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title data-i18n="pageTitle">黑盒智能开发者平台</title>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
<script src="lang.js"></script>
|
|
<script src="manage.js"></script>
|
|
<script src="chat.js"></script>
|
|
<script src="module.js"></script>
|
|
<script src="center.js"></script>
|
|
<script src="docs.js"></script>
|
|
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
font-family: 'Arial', sans-serif;
|
|
}
|
|
|
|
body {
|
|
display: flex;
|
|
min-height: 100vh;
|
|
background-color: #f0f2f5;
|
|
}
|
|
|
|
.sidebar {
|
|
/* 固定宽度和位置 */
|
|
width: 250px;
|
|
min-width: 250px; /* 防止收缩 */
|
|
height: 100vh; /* 视窗高度 */
|
|
position: fixed; /* 固定位置 */
|
|
left: 0;
|
|
top: 0;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: #fff;
|
|
padding: 20px;
|
|
transition: transform 0.3s ease;
|
|
}
|
|
.sidebar.open {
|
|
transform: translateX(0);
|
|
}
|
|
.sidebar-header {
|
|
text-align: center;
|
|
/*padding: 10px 0;*/
|
|
}
|
|
|
|
.logo {
|
|
max-width: 80%; /* 调整这个值以适应您的侧边栏宽度 */
|
|
height: 80%;
|
|
display: block;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.sidebar-menu {
|
|
list-style: none;
|
|
padding: 0;
|
|
}
|
|
|
|
.menu-category {
|
|
font-weight: bold;
|
|
color: #fff;
|
|
padding: 15px 20px 10px;
|
|
text-transform: uppercase;
|
|
font-size: 20px;
|
|
letter-spacing: 1px;
|
|
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.sidebar-menu li:not(.menu-category) {
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.sidebar-menu a {
|
|
color: #fff;
|
|
text-decoration: none;
|
|
display: block;
|
|
padding: 10px 20px;
|
|
transition: all 0.3s ease;
|
|
border-radius: 5px;
|
|
}
|
|
|
|
.sidebar-menu a:hover {
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
}
|
|
|
|
.sidebar-menu i {
|
|
margin-right: 10px;
|
|
width: 20px;
|
|
text-align: center;
|
|
}
|
|
|
|
.main-content {
|
|
flex: 1;
|
|
margin-left: 250px;
|
|
padding: 30px;
|
|
background-color: #fff;
|
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
border-radius: 10px;
|
|
margin-top: 20px;
|
|
margin-right: 20px;
|
|
margin-bottom: 20px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: calc(100vh - 40px);
|
|
max-width: 100%;
|
|
overflow-x: hidden;
|
|
transition: margin-left 0.3s ease;
|
|
}
|
|
.main-content.open {
|
|
margin-left: 250px;
|
|
}
|
|
.main-title {
|
|
font-size: 28px;
|
|
color: #333;
|
|
}
|
|
|
|
.user-info {
|
|
display: flex;
|
|
align-items: center;
|
|
cursor: pointer;
|
|
position: relative;
|
|
padding: 5px 10px;
|
|
border-radius: 20px;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
.user-info:hover {
|
|
background-color: rgba(0, 0, 0, 0.05);
|
|
}
|
|
|
|
.user-avatar {
|
|
width: 35px;
|
|
height: 35px;
|
|
border-radius: 50%;
|
|
margin-right: 10px;
|
|
}
|
|
|
|
.user-dropdown {
|
|
position: absolute;
|
|
top: 100%;
|
|
right: 0;
|
|
background-color: #fff;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
border-radius: 8px;
|
|
padding: 8px 0;
|
|
min-width: 150px;
|
|
display: none;
|
|
z-index: 1000;
|
|
}
|
|
|
|
.user-info:hover .user-dropdown {
|
|
display: block;
|
|
}
|
|
|
|
.user-dropdown a {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 8px 15px;
|
|
color: #333;
|
|
text-decoration: none;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
.user-dropdown a:hover {
|
|
background-color: #f5f5f5;
|
|
}
|
|
|
|
.user-dropdown i {
|
|
margin-right: 8px;
|
|
width: 16px;
|
|
color: #667eea;
|
|
}
|
|
|
|
|
|
.dashboard-cards {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 20px;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.card {
|
|
background-color: #fff;
|
|
border-radius: 10px;
|
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
padding: 20px;
|
|
text-align: center;
|
|
}
|
|
|
|
.card-icon {
|
|
font-size: 36px;
|
|
margin-bottom: 10px;
|
|
color: #667eea;
|
|
}
|
|
|
|
.card-title {
|
|
font-size: 18px;
|
|
color: #333;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.card-value {
|
|
font-size: 24px;
|
|
font-weight: bold;
|
|
color: #667eea;
|
|
}
|
|
|
|
.recent-activities {
|
|
background-color: #fff;
|
|
border-radius: 10px;
|
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
padding: 20px;
|
|
}
|
|
|
|
.recent-activities h3 {
|
|
font-size: 20px;
|
|
color: #333;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.activity-list {
|
|
list-style: none;
|
|
}
|
|
|
|
.activity-item {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 10px 0;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.activity-icon {
|
|
font-size: 18px;
|
|
color: #667eea;
|
|
margin-right: 10px;
|
|
}
|
|
|
|
.activity-details {
|
|
flex: 1;
|
|
}
|
|
|
|
.activity-description {
|
|
font-size: 14px;
|
|
color: #333;
|
|
}
|
|
|
|
.activity-time {
|
|
font-size: 12px;
|
|
color: #999;
|
|
}
|
|
|
|
.user-list {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
.user-list th, .user-list td {
|
|
padding: 12px;
|
|
text-align: left;
|
|
border-bottom: 1px solid #ddd;
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
.user-list th {
|
|
background-color: #f2f2f2;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
}
|
|
|
|
.user-list tr:hover {
|
|
background-color: #f5f5f5;
|
|
}
|
|
.toggle-sidebar {
|
|
display: none;
|
|
position: fixed;
|
|
top: 20px;
|
|
left: 20px;
|
|
background-color: #5473ff;
|
|
color: #fff;
|
|
border: none;
|
|
padding: 10px 15px;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
z-index: 1001;
|
|
}
|
|
.toggle-sidebar:hover {
|
|
background-color: #425ccf;
|
|
}
|
|
@media (max-width: 768px) {
|
|
.sidebar {
|
|
transform: translateX(-100%);
|
|
}
|
|
|
|
.main-content {
|
|
margin-left: 0;
|
|
margin-right: 10px; /* 调整右侧边距 */
|
|
max-width: calc(100% - 20px); /* 调整最大宽度 */
|
|
}
|
|
|
|
.toggle-sidebar {
|
|
display: block;
|
|
}
|
|
}
|
|
.search-bar {
|
|
display: flex;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.search-bar input {
|
|
width: 100%;
|
|
padding: 10px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 5px 0 0 5px;
|
|
border-right: none;
|
|
transition: border-color 0.3s;
|
|
}
|
|
|
|
.search-bar input:focus {
|
|
border-color: #667eea;
|
|
outline: none;
|
|
box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
|
|
}
|
|
|
|
.search-button {
|
|
padding: 0 15px;
|
|
background-color: #667eea;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 0 5px 5px 0;
|
|
cursor: pointer;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
.search-button:hover {
|
|
background-color: #5a6cd0;
|
|
}
|
|
|
|
.user-actions {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
|
|
.btn-mange {
|
|
padding: 10px 12px;
|
|
background-color: #667eea;
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 10px;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
font-size: 12px;
|
|
align-items: center;
|
|
display: flex; /* Add this line */
|
|
justify-content: center; /* Add this line */
|
|
}
|
|
|
|
.btn-mange:hover {
|
|
background-color: #5a6cd0;
|
|
transform: translateY(-3px);
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
}
|
|
.chart-container {
|
|
margin-top: 30px;
|
|
height: 300px;
|
|
}
|
|
|
|
#addUserModal {
|
|
display: none;
|
|
position: fixed;
|
|
z-index: 1;
|
|
left: 0;
|
|
top: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: auto;
|
|
background-color: rgba(0,0,0,0.4);
|
|
}
|
|
|
|
.modal-content {
|
|
background-color: #fefefe;
|
|
margin: 15% auto;
|
|
padding: 20px;
|
|
border: 1px solid #888;
|
|
width: 80%;
|
|
max-width: 500px;
|
|
border-radius: 5px;
|
|
}
|
|
|
|
.close {
|
|
color: #aaa;
|
|
float: right;
|
|
font-size: 28px;
|
|
font-weight: bold;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.close:hover,
|
|
.close:focus {
|
|
color: black;
|
|
text-decoration: none;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.form-group label {
|
|
display: block;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.form-group input {
|
|
width: 100%;
|
|
padding: 8px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.main-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 10px 20px;
|
|
background-color: #fff;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.left-section, .right-section {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
|
|
.theme-toggle-btn, .notifications {
|
|
background: none;
|
|
border: none;
|
|
font-size: 18px;
|
|
margin-right: 15px;
|
|
cursor: pointer;
|
|
position: relative;
|
|
}
|
|
|
|
.notification-count {
|
|
position: absolute;
|
|
top: -5px;
|
|
right: -5px;
|
|
background-color: #ff4757;
|
|
color: #fff;
|
|
font-size: 12px;
|
|
padding: 2px 5px;
|
|
border-radius: 50%;
|
|
}
|
|
|
|
.user-info {
|
|
display: flex;
|
|
align-items: center;
|
|
cursor: pointer;
|
|
position: relative;
|
|
}
|
|
|
|
.user-avatar {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 50%;
|
|
margin-right: 10px;
|
|
}
|
|
|
|
.user-dropdown {
|
|
display: none;
|
|
position: absolute;
|
|
top: 100%;
|
|
right: 0;
|
|
background-color: #fff;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
border-radius: 4px;
|
|
padding: 10px 8px;
|
|
width: 150px;
|
|
}
|
|
|
|
.user-dropdown a {
|
|
display: block;
|
|
padding: 8px 15px;
|
|
color: #333;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.user-dropdown a:hover {
|
|
background-color: #f5f5f5;
|
|
}
|
|
|
|
.user-info:hover .user-dropdown {
|
|
display: block;
|
|
}
|
|
|
|
.chat-container {
|
|
display: none;
|
|
flex-direction: column;
|
|
height: 100%;
|
|
background-color: #f9f9f9;
|
|
border-radius: 10px;
|
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.chat-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 10px 20px;
|
|
background: linear-gradient(90deg, #667eea, #764ba2); /* 渐变背景 */
|
|
color: #fff;
|
|
border-radius: 10px 10px 0 0;
|
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 阴影效果 */
|
|
font-size: 1em; /* 调整字体大小 */
|
|
font-weight: bold; /* 加粗字体 */
|
|
}
|
|
.voice-select {
|
|
padding: 5px;
|
|
border-radius: 5px;
|
|
border: 1px solid #ccc;
|
|
font-size: 14px;
|
|
}
|
|
.chat-body {
|
|
flex: 1;
|
|
padding: 20px;
|
|
background-color: #fff;
|
|
overflow-y: auto;
|
|
border-left: 1px solid #ddd;
|
|
border-right: 1px solid #ddd;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.chat-footer {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 10px 20px;
|
|
background-color: #fff; /* 删除背景的灰色 */
|
|
border-radius: 0 0 10px 10px;
|
|
position: relative;
|
|
}
|
|
|
|
.chat-input {
|
|
flex: 1;
|
|
padding: 10px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 25px;
|
|
outline: none;
|
|
font-size: 16px;
|
|
padding-left: 15px;
|
|
padding-right: 60px; /* 为图标留出空间 */
|
|
}
|
|
|
|
.send-icon, .mic-icon {
|
|
position: absolute;
|
|
font-size: 20px;
|
|
color: #a29bfe;
|
|
cursor: pointer;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
}
|
|
|
|
.send-icon {
|
|
right: 60px;
|
|
}
|
|
|
|
.mic-icon {
|
|
right: 30px;
|
|
}
|
|
|
|
.mic-icon.recording {
|
|
color: red;
|
|
}
|
|
|
|
.chat-button {
|
|
display: none; /* 隐藏原有的按钮 */
|
|
}
|
|
|
|
.message {
|
|
margin-bottom: 10px;
|
|
padding: 10px;
|
|
border-radius: 5px;
|
|
max-width: 60%;
|
|
}
|
|
|
|
.user-message {
|
|
background-color: #e1e1e1;
|
|
align-self: flex-end;
|
|
text-align: right;
|
|
}
|
|
|
|
.assistant-message {
|
|
background-color: #667eea;
|
|
color: #fff;
|
|
align-self: flex-start;
|
|
text-align: left;
|
|
}
|
|
|
|
.feature-container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
padding: 30px;
|
|
background-color: #fff;
|
|
border-radius: 15px;
|
|
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
|
|
margin: 20px;
|
|
width: calc(100% - 40px);
|
|
height: calc(100vh - 100px);
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.feature-header {
|
|
font-size: 32px;
|
|
font-weight: bold;
|
|
margin-bottom: 40px;
|
|
color: #333;
|
|
text-align: center;
|
|
}
|
|
|
|
.feature-buttons {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 15px;
|
|
justify-content: flex-start; /* 改为靠左对齐 */
|
|
margin-bottom: 30px;
|
|
width: 100%;
|
|
}
|
|
|
|
|
|
.action-buttons {
|
|
display: flex;
|
|
gap: 15px;
|
|
margin-bottom: 30px;
|
|
width: 100%;
|
|
justify-content: flex-start; /* 改为靠左对齐 */
|
|
}
|
|
|
|
/* 可能需要调整按钮宽度,以确保它们在一行内显示 */
|
|
.feature-buttons button, .action-buttons button {
|
|
flex: 0 1 auto; /* 允许按钮根据内容自动调整宽度 */
|
|
}
|
|
|
|
|
|
.feature-buttons button {
|
|
padding: 10px 12px;
|
|
background-color: #667eea;
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 10px;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.feature-buttons button:hover {
|
|
background-color: #5a6cd0;
|
|
transform: translateY(-3px);
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
}
|
|
|
|
.btn {
|
|
padding: 10px 12px;
|
|
background-color: #667eea;
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 10px;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.btn:hover {
|
|
background-color: #5a6cd0;
|
|
transform: translateY(-3px);
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
}
|
|
.input-group {
|
|
display: flex;
|
|
gap: 15px;
|
|
width: 100%;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
#aiInput {
|
|
flex: 1;
|
|
padding: 10px;
|
|
border: 2px solid #ddd;
|
|
border-radius: 10px;
|
|
font-size: 12px;
|
|
transition: border-color 0.3s ease;
|
|
}
|
|
|
|
#aiInput:focus {
|
|
border-color: #667eea;
|
|
outline: none;
|
|
}
|
|
|
|
.action-buttons button {
|
|
padding: 10px 12px;
|
|
font-size: 14px;
|
|
background-color: #667eea;
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 10px;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.action-buttons button:hover {
|
|
background-color: #5a6cd0;
|
|
transform: translateY(-3px);
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.feature-container {
|
|
padding: 20px;
|
|
margin: 10px;
|
|
width: calc(100% - 20px);
|
|
height: calc(100vh - 80px);
|
|
}
|
|
.feature-buttons, .input-group, .action-buttons {
|
|
flex-direction: row;
|
|
align-items: flex-start; /* 在移动设备上保持左对齐 */
|
|
}
|
|
|
|
.feature-buttons button, .action-buttons button {
|
|
width: auto; /* 在移动设备上允许按钮宽度自适应 */
|
|
}
|
|
.feature-header {
|
|
font-size: 28px;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
.preview-area, .result-area {
|
|
width: 100%;
|
|
margin-bottom: 30px;
|
|
background-color: #f8f9fa;
|
|
border-radius: 15px;
|
|
padding: 25px;
|
|
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
|
|
}
|
|
|
|
.preview-area img, .preview-area video {
|
|
max-width: 100%;
|
|
border-radius: 10px;
|
|
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
|
|
}
|
|
|
|
.loading-indicator {
|
|
display: none;
|
|
margin-bottom: 30px;
|
|
font-size: 18px;
|
|
color: #667eea;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.result-area h3 {
|
|
font-size: 20px;
|
|
color: #333;
|
|
margin-bottom: 20px;
|
|
}
|
|
.result-cards-container {
|
|
width: 100%;
|
|
overflow-x: auto;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.result-card {
|
|
display: inline-block;
|
|
vertical-align: top;
|
|
white-space: normal;
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
padding: 10px;
|
|
border: 1px solid #ddd;
|
|
margin-bottom: 10px;
|
|
background-color: #f9f9f9;
|
|
}
|
|
|
|
.result-card h3 {
|
|
margin-top: 0;
|
|
}
|
|
|
|
.result-card pre {
|
|
white-space: pre-wrap;
|
|
word-wrap: break-word;
|
|
max-width: 100%;
|
|
overflow-x: auto;
|
|
}
|
|
|
|
.user-center-container {
|
|
display: flex;
|
|
background-color: #fff;
|
|
border-radius: 10px;
|
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.user-center-nav {
|
|
width: 200px;
|
|
background-color: #f0f2f5;
|
|
padding: 20px 0;
|
|
}
|
|
|
|
|
|
.user-center-content {
|
|
flex: 1;
|
|
padding: 30px;
|
|
}
|
|
|
|
.user-center-section {
|
|
display: none;
|
|
}
|
|
|
|
.user-center-section.active {
|
|
display: block;
|
|
}
|
|
|
|
.user-center-section h2 {
|
|
margin-bottom: 20px;
|
|
color: #333;
|
|
}
|
|
|
|
#profileForm {
|
|
max-width: 500px;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.form-group label {
|
|
display: block;
|
|
margin-bottom: 5px;
|
|
color: #666;
|
|
}
|
|
|
|
.form-group input {
|
|
width: 100%;
|
|
padding: 8px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.btn-update {
|
|
background-color: #667eea;
|
|
color: #fff;
|
|
border: none;
|
|
padding: 10px 20px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
.btn-update:hover {
|
|
background-color: #5a6cd0;
|
|
}
|
|
|
|
.api-key-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.api-key-table th,
|
|
.api-key-table td {
|
|
border: 1px solid #ddd;
|
|
padding: 12px;
|
|
text-align: center; /* 将所有单元格内容居中 */
|
|
}
|
|
|
|
.api-key-table th {
|
|
background-color: #f2f2f2;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.btn-toggle, .btn-copy {
|
|
padding: 5px 10px;
|
|
margin-right: 5px;
|
|
background-color: #f0f0f0;
|
|
border: 1px solid #ddd;
|
|
border-radius: 3px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.btn-toggle:hover, .btn-copy:hover {
|
|
background-color: #e0e0e0;
|
|
}
|
|
|
|
.toggle-visibility {
|
|
cursor: pointer;
|
|
}
|
|
|
|
.api-key-value {
|
|
cursor: pointer;
|
|
}
|
|
|
|
|
|
.btn-delete {
|
|
background-color: #667eea;
|
|
color: white;
|
|
border: none;
|
|
padding: 5px 8px;
|
|
cursor: pointer;
|
|
border-radius: 5px;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.btn-delete:hover {
|
|
background-color: #5a6cd0;
|
|
}
|
|
|
|
.btn-generate-key, .btn-refresh{
|
|
background-color: #667eea;
|
|
color: white;
|
|
border: none;
|
|
padding: 10px 10px;
|
|
cursor: pointer;
|
|
border-radius: 10px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.btn-refresh:hover,.btn-generate-key:hover {
|
|
background-color: #5a6cd0;
|
|
}
|
|
|
|
.api-key-controls {
|
|
margin-bottom: 15px;
|
|
}
|
|
.rate-limit-table {
|
|
width: 100%;
|
|
border-collapse: separate;
|
|
border-spacing: 0;
|
|
border: 1px solid #e0e0e0;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.rate-limit-table th,
|
|
.rate-limit-table td {
|
|
padding: 12px 15px;
|
|
text-align: center;
|
|
border-bottom: 1px solid #e0e0e0;
|
|
}
|
|
|
|
.rate-limit-table th {
|
|
background-color: #f5f7fa;
|
|
font-weight: bold;
|
|
color: #333;
|
|
text-transform: uppercase;
|
|
font-size: 0.9em;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.rate-limit-table tr:last-child td {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.rate-limit-table tr:nth-child(even) {
|
|
background-color: #f9f9f9;
|
|
}
|
|
|
|
.rate-limit-table tr:hover {
|
|
background-color: #f0f4f8;
|
|
transition: background-color 0.3s ease;
|
|
}
|
|
|
|
.rate-limit-table td:first-child {
|
|
font-weight: 500;
|
|
color: #4a4a4a;
|
|
}
|
|
|
|
.rate-limit-table td:nth-child(3),
|
|
.rate-limit-table td:nth-child(4) {
|
|
font-family: monospace;
|
|
color: #0066cc;
|
|
}
|
|
|
|
#apiUsageContent h3 {
|
|
color: #333;
|
|
font-size: 1.5em;
|
|
margin-bottom: 15px;
|
|
border-bottom: 2px solid #667eea;
|
|
padding-bottom: 10px;
|
|
}
|
|
|
|
#apiUsageContent button {
|
|
background-color: #667eea;
|
|
color: white;
|
|
border: none;
|
|
padding: 10px 15px;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
transition: background-color 0.3s ease;
|
|
margin-top: 15px;
|
|
}
|
|
|
|
#apiUsageContent button:hover {
|
|
background-color: #5a6cd0;
|
|
}
|
|
|
|
|
|
.usage-tabs {
|
|
display: flex;
|
|
border-bottom: 2px solid #e0e0e0;
|
|
margin-bottom: 20px;
|
|
width: 100%;
|
|
}
|
|
|
|
.tab-btn::after {
|
|
content: '';
|
|
position: absolute;
|
|
bottom: -2px;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 2px;
|
|
background-color: #4a54e0;
|
|
transform: scaleX(0);
|
|
transition: transform 0.3s ease;
|
|
}
|
|
|
|
.tab-btn.active::after {
|
|
transform: scaleX(1);
|
|
}
|
|
|
|
.tab-content {
|
|
display: none;
|
|
opacity: 0;
|
|
transition: opacity 0.3s ease;
|
|
}
|
|
|
|
.tab-content.active {
|
|
display: block;
|
|
opacity: 1;
|
|
animation: fadeIn 0.5s ease-in-out;
|
|
}
|
|
|
|
.usage-tabs .tab-btn {
|
|
padding: 10px 20px;
|
|
border: none;
|
|
background: none;
|
|
font-size: 16px;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
margin: 0;
|
|
color: #333;
|
|
flex: 1;
|
|
text-align: center;
|
|
position: relative;
|
|
}
|
|
|
|
.usage-tabs .tab-btn:hover {
|
|
color: #4a54e0 !important;
|
|
}
|
|
|
|
.usage-tabs .tab-btn.active {
|
|
color: #4a54e0 !important;
|
|
font-weight: bold;
|
|
}
|
|
|
|
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; }
|
|
to { opacity: 1; }
|
|
}
|
|
|
|
|
|
.profile-container {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
justify-content: space-between;
|
|
width: 100%;
|
|
padding: 20px;
|
|
}
|
|
|
|
.profile-info {
|
|
flex: 1;
|
|
min-width: 300px;
|
|
margin-right: 30px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.profile-info h2 {
|
|
margin-bottom: 20px;
|
|
font-size: 24px;
|
|
color: #24292e;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.form-group label {
|
|
display: block;
|
|
margin-bottom: 5px;
|
|
font-weight: 600;
|
|
color: #24292e;
|
|
}
|
|
|
|
.form-group input,
|
|
.form-group textarea {
|
|
width: 100%;
|
|
padding: 8px 12px;
|
|
border: 1px solid #e1e4e8;
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
line-height: 20px;
|
|
}
|
|
|
|
.form-group input:focus,
|
|
.form-group textarea:focus {
|
|
border-color: #0366d6;
|
|
outline: none;
|
|
box-shadow: 0 0 0 3px rgba(3,102,214,0.3);
|
|
}
|
|
|
|
.field-description {
|
|
margin-top: 5px;
|
|
font-size: 12px;
|
|
color: #586069;
|
|
}
|
|
|
|
.btn-update {
|
|
padding: 8px 16px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
color: #fff;
|
|
background-color: #667eea;
|
|
border: 1px solid rgba(27,31,35,0.15);
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.btn-update:hover {
|
|
background-color: #4a54e0;
|
|
}
|
|
|
|
.profile-picture {
|
|
width: 260px;
|
|
text-align: center;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.profile-picture img {
|
|
width: 260px;
|
|
height: 260px;
|
|
border-radius: 50%;
|
|
object-fit: cover;
|
|
border: 1px solid #e1e4e8;
|
|
}
|
|
.avatar-modal {
|
|
position: fixed;
|
|
z-index: 1000;
|
|
left: 0;
|
|
top: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.avatar-modal-content {
|
|
background-color: #fff;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
max-width: 400px;
|
|
width: 100%;
|
|
}
|
|
|
|
.avatar-modal-content h3 {
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
#avatarOptions {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
justify-content: center;
|
|
gap: 10px;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.avatar-option {
|
|
width: 60px;
|
|
height: 60px;
|
|
border-radius: 50%;
|
|
cursor: pointer;
|
|
border: 2px solid transparent;
|
|
transition: border-color 0.3s;
|
|
}
|
|
|
|
.avatar-option:hover {
|
|
border-color: #667eea;
|
|
}
|
|
|
|
.avatar-modal-content button {
|
|
display: block;
|
|
width: 100%;
|
|
padding: 10px;
|
|
background-color: #667eea;
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.avatar-modal-content button:hover {
|
|
background-color: #5a6cd0;
|
|
}
|
|
|
|
|
|
.pagination {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.pagination a {
|
|
color: #333;
|
|
float: left;
|
|
padding: 8px 16px;
|
|
text-decoration: none;
|
|
transition: background-color .3s;
|
|
margin: 0 4px;
|
|
font-size: 12px;
|
|
background-color: white;
|
|
border-radius: 10px;
|
|
}
|
|
|
|
.pagination a.page-number {
|
|
border: 1px solid #ddd;
|
|
width: 28px;
|
|
height: 28px;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
padding: 10 px;
|
|
}
|
|
|
|
.pagination a.active {
|
|
background-color: #667eea; /* 更新为浅蓝色 */
|
|
color: white;
|
|
border: 1px solid #667eea;
|
|
}
|
|
|
|
.pagination a:hover:not(.active) {
|
|
background-color: #f1f1f1;
|
|
}
|
|
|
|
.page-nav {
|
|
background-color: white;
|
|
border: none;
|
|
width: 30px;
|
|
height: 30px;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.page-ellipsis {
|
|
border: none;
|
|
padding: 8px 5px;
|
|
background-color: transparent;
|
|
margin: 0 4px;
|
|
}
|
|
.api-docs-container {
|
|
padding: 20px;
|
|
background-color: #fff;
|
|
border-radius: 10px;
|
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
}
|
|
.section-title {
|
|
font-size: 24px;
|
|
color: #333;
|
|
margin-bottom: 20px;
|
|
}
|
|
.api-section {
|
|
margin-bottom: 30px;
|
|
}
|
|
.api-section h3 {
|
|
font-size: 20px;
|
|
color: #667eea;
|
|
margin-bottom: 15px;
|
|
}
|
|
.api-section h4 {
|
|
font-size: 18px;
|
|
color: #333;
|
|
margin-top: 20px;
|
|
margin-bottom: 10px;
|
|
}
|
|
.api-section p {
|
|
margin-bottom: 10px;
|
|
}
|
|
pre {
|
|
background-color: #f4f4f4;
|
|
border: 1px solid #ddd;
|
|
border-left: 3px solid #667eea;
|
|
color: #666;
|
|
page-break-inside: avoid;
|
|
font-family: monospace;
|
|
font-size: 15px;
|
|
line-height: 1.6;
|
|
margin-bottom: 1.6em;
|
|
max-width: 100%;
|
|
overflow: auto;
|
|
padding: 1em 1.5em;
|
|
display: block;
|
|
word-wrap: break-word;
|
|
}
|
|
.btn-primary {
|
|
background-color: #667eea;
|
|
color: #fff;
|
|
border: none;
|
|
padding: 10px 20px;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
transition: background-color 0.3s;
|
|
}
|
|
.btn-primary:hover {
|
|
background-color: #5a6cd0;
|
|
}
|
|
.profile-container, .verification-card {
|
|
background-color: #fff;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
padding: 20px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.profile-container h3, .verification-card h3 {
|
|
margin-top: 0;
|
|
margin-bottom: 20px;
|
|
color: #333;
|
|
font-size: 1.5em;
|
|
|
|
}
|
|
|
|
.verification-content {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
font-weight: bold;
|
|
}
|
|
|
|
#verificationCodeSection {
|
|
margin-top: 10px;
|
|
}
|
|
|
|
#verificationCode {
|
|
padding: 5px;
|
|
margin-right: 10px;
|
|
}
|
|
|
|
.btn-verify {
|
|
background-color: #667eea;
|
|
color: #fff;
|
|
border: none;
|
|
padding: 10px 20px;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
.btn-verify:hover {
|
|
background-color: #5a6cd0;
|
|
}
|
|
|
|
#emailStatus {
|
|
color:#FF0000;
|
|
}
|
|
/* 添加语言选择器的样式 */
|
|
.language-select {
|
|
padding: 5px;
|
|
margin-right: 10px;
|
|
border-radius: 5px;
|
|
border: 1px solid #ddd;
|
|
background-color: #fff;
|
|
color: #333;
|
|
}
|
|
|
|
.dark-mode .language-select {
|
|
background-color: #333;
|
|
color: #fff;
|
|
border-color: #555;
|
|
}
|
|
|
|
.custom-dialog {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background: rgba(0, 0, 0, 0.5);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 1000;
|
|
}
|
|
|
|
.dialog-content {
|
|
background: white;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
min-width: 300px;
|
|
}
|
|
|
|
.dialog-buttons {
|
|
margin-top: 20px;
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
gap: 10px;
|
|
}
|
|
|
|
.edit-user-form {
|
|
margin: 15px 0;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.form-group label {
|
|
display: block;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.form-group input,
|
|
.form-group select {
|
|
width: 100%;
|
|
padding: 8px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
/* 修改 toast 相关样式 */
|
|
.toast-container {
|
|
position: fixed;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
z-index: 9999;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.toast {
|
|
background: rgba(236, 236, 236, 0.15);; /* 统一使用灰色半透明背景 */
|
|
color: #000; /* 统一使用黑色文字 */
|
|
padding: 15px 25px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
opacity: 0;
|
|
transition: all 0.3s ease;
|
|
pointer-events: auto;
|
|
max-width: 80vw;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.toast.show {
|
|
opacity: 1;
|
|
}
|
|
|
|
/* 移除所有特定类型的背景色和文字颜色设置 */
|
|
.toast-success,
|
|
.toast-error,
|
|
.toast-info,
|
|
.toast-warning {
|
|
background: rgba(236, 236, 236, 0.15); /* 统一使用灰色半透明背景 */
|
|
color: #000; /* 统一使用黑色文字 */
|
|
}
|
|
|
|
/* 修改图标颜色 */
|
|
.toast i {
|
|
font-size: 20px;
|
|
color: #000; /* 图标也使用黑色 */
|
|
}
|
|
|
|
/* 暗色模式适配 */
|
|
.dark-mode .toast {
|
|
background: rgba(255, 255, 255, 0.15); /* 暗色模式下使用浅色半透明背景 */
|
|
color: #fff; /* 暗色模式下使用白色文字 */
|
|
}
|
|
|
|
.dark-mode .toast i {
|
|
color: #fff; /* 暗色模式下图标使用白色 */
|
|
}
|
|
|
|
/* 编辑和删除按钮的基础样式 */
|
|
.user-list button {
|
|
border: none;
|
|
border-radius: 5px;
|
|
padding: 7px 8px;
|
|
margin: 0 3px;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
/* 编辑按钮样式 */
|
|
.user-list button:first-child {
|
|
background-color: #667eea;
|
|
}
|
|
|
|
.user-list button:first-child i {
|
|
color: white;
|
|
}
|
|
|
|
/* 删除按钮样式 */
|
|
.user-list button:last-child {
|
|
background-color: #e3e3e3;
|
|
}
|
|
|
|
.user-list button:last-child i {
|
|
color: #434343;
|
|
}
|
|
|
|
/* 悬停效果 */
|
|
.user-list button:hover {
|
|
opacity: 0.8;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body onload="checkLoginStatus()">
|
|
<button class="toggle-sidebar">
|
|
<i class="fas fa-bars"></i>
|
|
</button>
|
|
<nav class="sidebar">
|
|
<div class="sidebar-header">
|
|
<img src="logo2.png" alt="用户管理系统" class="logo">
|
|
</div>
|
|
<ul class="sidebar-menu">
|
|
<li class="menu-category" data-i18n="experienceCenter">体验中心</li>
|
|
<li><a href="#" onclick="showChat()"><i class="fas fa-comments"></i> <span data-i18n="chatAssistant">智能助手</span></a></li>
|
|
<li><a href="#" onclick="showFeature()"><i class="fas fa-image"></i> <span data-i18n="featureDemo">功能展示</span></a></li>
|
|
|
|
<li class="menu-category" data-i18n="userManagement">用户管理</li>
|
|
<li><a href="#" onclick="showDashboard()"><i class="fas fa-tachometer-alt"></i> <span data-i18n="dashboard">仪表盘</span></a></li>
|
|
<li><a href="#" onclick="showUsers()"><i class="fas fa-users"></i> <span data-i18n="userManagement">用户管理</span></a></li>
|
|
|
|
<li class="menu-category" data-i18n="userCenter">用户中心</li>
|
|
<li><a href="#" onclick="showUserCenterSection('profile')"><i class="fas fa-user"></i> <span data-i18n="profile">个人资料</span></a></li>
|
|
<li><a href="#" onclick="showUserCenterSection('apiKey')"><i class="fas fa-key"></i> <span data-i18n="apiKey">API 密钥</span></a></li>
|
|
<li><a href="#" onclick="showUserCenterSection('apiUsage')"><i class="fas fa-tachometer-alt"></i> <span data-i18n="apiUsage">模型调用</span></a></li>
|
|
|
|
<li class="menu-category" data-i18n="systemSettings">系统设置</li>
|
|
<li><a href="#" onclick="showApiDocs()"><i class="fas fa-book"></i> <span data-i18n="docs">文档</span></a></li>
|
|
<li><a href="#" onclick="logout()"><i class="fas fa-sign-out-alt"></i> <span data-i18n="logout">退出账户</span></a></li>
|
|
</ul>
|
|
</nav>
|
|
|
|
<main class="main-content">
|
|
<header class="main-header">
|
|
<div class="left-section">
|
|
<h1 class="main-title" id="pageTitle" data-i18n="pageTitle"></h1>
|
|
</div>
|
|
<div class="right-section">
|
|
<select id="languageSelector" class="language-select">
|
|
<option value="zh">中文</option>
|
|
<option value="en">English</option>
|
|
<option value="ko">국어</option>
|
|
</select>
|
|
<button id="themeToggle" class="theme-toggle-btn">
|
|
<i class="fas fa-moon"></i>
|
|
</button>
|
|
<div class="user-info">
|
|
<img src="picture/cn__03041_.png" alt="用户头像" id="userAvatar" class="user-avatar">
|
|
<span class="user-name" id="userName"></span>
|
|
<i class="fas fa-chevron-down"></i>
|
|
<div class="user-dropdown">
|
|
<a href="#" onclick="showUserCenterSection('profile')"><i class="fas fa-user"></i> <span data-i18n="profile">个人资料</span></a>
|
|
<a href="#" onclick="logout()"><i class="fas fa-sign-out-alt"></i> <span data-i18n="logout">退出账户</span></a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<div id="apiDocsContent" style="display: none;">
|
|
<div class="api-docs-container">
|
|
<h2 class="section-title" data-i18n="apiDocs">API 文档</h2>
|
|
<div class="api-docs-content">
|
|
<div class="api-section">
|
|
<h3 data-i18n="quickStart">快速开始</h3>
|
|
<p data-i18n="welcomeApi">欢迎使用我们的API。本文档将指导您如何快速开始使用我们的服务。</p>
|
|
<p><span data-i18n="baseUrl">基础URL</span>: <code>https://dev.obscura.work/</code></p>
|
|
</div>
|
|
<div class="api-section">
|
|
<h3 data-i18n="authentication">认证</h3>
|
|
<p data-i18n="authDescription">所有API请求都需要使用API密钥进行认证。您可以在用户中心的API密钥页面获取的API密钥。</p>
|
|
</div>
|
|
<div class="api-section">
|
|
<h3 data-i18n="sampleCode">示例代码</h3>
|
|
<h4 data-i18n="pythonCode">Python</h4>
|
|
<pre><code>import requests
|
|
base_url = 'https://dev.obscura.work/v1'
|
|
headers = {
|
|
'accept': 'application/json',
|
|
'Authorization': 'Bearer YOUR_API_KEY', # <span data-i18n="replaceApiKey">替换为您的 API 密钥</span>
|
|
'Content-Type': 'application/json'
|
|
}
|
|
# <span data-i18n="replaceFilePath">替换为您的文件路径</span>
|
|
file_path = 'PATH_TO_YOUR_FILE'
|
|
|
|
# <span data-i18n="replaceModelName">替换为模型名称</span>
|
|
upload_url = f'{base_url}/MODEL_NAME'
|
|
with open(file_path, 'rb') as file:
|
|
data = {'image': file}
|
|
response = requests.post(upload_url, headers=headers, files=data)
|
|
response.raise_for_status()
|
|
result = response.json()
|
|
task_id = result.get('task_id')
|
|
|
|
annotated_url = f'{base_url}/annotated/{task_id}'
|
|
response = requests.get(annotated_url, headers=headers)
|
|
response.raise_for_status()
|
|
|
|
with open(f'annotated_{task_id}.jpg', 'wb') as f:
|
|
f.write(response.content)
|
|
print(f"<span data-i18n='annotatedImageSaved'>标注图片已保存为</span> annotated_{task_id}.jpg")
|
|
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="featureContent" class="feature-container" style="display: none;">
|
|
<div class="feature-buttons">
|
|
<button id="poseButton" data-i18n="poseAnalysis">姿态分析</button>
|
|
<button id="fallButton" data-i18n="fallDetection">跌倒检测</button>
|
|
<button id="objectButton" data-i18n="objectDetection">目标检测</button>
|
|
<button id="faceButton" data-i18n="faceDetection">人脸检测</button>
|
|
<button id="compareButton" data-i18n="compare">面部特征提取</button>
|
|
<button id="mediapipeButton" data-i18n="mediapipeFaceRecognition">mediapipe面部识别</button>
|
|
<button id="cpmButton" data-i18n="miniCPMContentAnalysis">MiniCPM内容分析</button>
|
|
<button id="qwenvlButton" data-i18n="qwenContentAnalysis">Qwen内容分析</button>
|
|
<button id="cpmanalyzeButton" data-i18n="miniCPMAnalysis">MiniCPM_OCR分析</button>
|
|
<button id="qwenvlanalyzeButton" data-i18n="qwenAnalysis">Qwen_OCR分析</button>
|
|
</div>
|
|
|
|
<div class="input-group">
|
|
<input type="text" id="aiInput" data-i18n-placeholder="inputImageUrl">
|
|
<button id="fileInputButton" class="btn" data-i18n="selectFile">选择文件</button>
|
|
<input type="file" id="fileInput" accept="image/*,video/*" style="display: none;">
|
|
</div>
|
|
<div class="input-group mt-3">
|
|
<input type="text" id="apiKeyInput" data-i18n-placeholder="inputApiKey" class="form-control" style="border-radius: 10px; padding: 10px; border: 1px solid #ddd; font-size: 12px;border-color: #667eea;">
|
|
</div>
|
|
<div class="action-buttons">
|
|
<button id="takePictureButton" data-i18n="takePicture">拍照</button>
|
|
<button id="recordVideoButton" data-i18n="recordVideo">录制视频</button>
|
|
<button id="stopRecordingButton" style="display: none;" data-i18n="stopRecording">停止录制</button>
|
|
<button id="clearButton" data-i18n="clear">清除</button>
|
|
</div>
|
|
|
|
<div class="preview-area" id="previewArea">
|
|
<p data-i18n="pleaseInputImageUrl">请输入图片URL或上传图片</p>
|
|
</div>
|
|
|
|
<div class="loading-indicator" id="loadingIndicator" data-i18n="loading">加载中...</div>
|
|
|
|
<div class="result-area" id="resultArea">
|
|
<h3 data-i18n="detectionResult">检测结果</h3>
|
|
<div class="result-cards-container"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="dashboardContent">
|
|
<!-- dashboard data will be inserted here -->
|
|
|
|
</div>
|
|
|
|
<div id="usersContent" style="display: none;">
|
|
<div class="search-bar">
|
|
<input type="text" id="userSearch" data-i18n-placeholder="searchPlaceholder">
|
|
<button class="search-button"><i class="fas fa-search"></i></button>
|
|
</div>
|
|
<div class="user-actions">
|
|
<button class="btn-mange" onclick="openAddUserModal()" data-i18n="addUser"></button>
|
|
<button class="btn-mange" onclick="exportUserData()" data-i18n="exportUserData"></button>
|
|
</div>
|
|
<table class="user-list">
|
|
<thead>
|
|
<tr>
|
|
<th> </th>
|
|
<th data-i18n="name">Name</th>
|
|
<th data-i18n="email">Email</th>
|
|
<th data-i18n="role">Role</th>
|
|
<th data-i18n="actions">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="userTableBody">
|
|
<!-- User data will be inserted here -->
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="pagination">
|
|
<!-- pagination will be inserted here -->
|
|
</div>
|
|
</div>
|
|
|
|
<div id="chatContent" class="chat-container" style="display: none;">
|
|
<div class="chat-header">
|
|
<h2 data-i18n="chatAssistant">小Box_v1.1.2</h2>
|
|
<select id="voiceSelect" class="voice-select">
|
|
<option value="default" selected data-i18n="defaultVoice">默认音色</option>
|
|
<option value="girl" data-i18n="girlVoice">女孩</option>
|
|
<option value="woman" data-i18n="womanVoice">年轻女性</option>
|
|
<option value="man" data-i18n="manVoice">年轻男性</option>
|
|
<option value="leijun" data-i18n="leijun">雷军</option>
|
|
<option value="dufu" data-i18n="dufu">杜甫</option>
|
|
<option value="hejiong" data-i18n="hejiong">何炅</option>
|
|
<option value="mahuateng" data-i18n="mahuateng">马化腾</option>
|
|
<option value="lidan" data-i18n="lidan">李诞</option>
|
|
<option value="yuhua" data-i18n="yuhua">余华</option>
|
|
<option value="liuzhenyun" data-i18n="liuzhenyun">刘震云</option>
|
|
<option value="dabing" data-i18n="dabing">大冰</option>
|
|
<option value="luoxiang" data-i18n="luoxiang">罗翔</option>
|
|
<option value="xuzhiyuan" data-i18n="xuzhiyuan">许知远</option>
|
|
</select>
|
|
</div>
|
|
<div class="chat-body" id="conversationLog">
|
|
<!-- 聊天记录将显示在这里 -->
|
|
</div>
|
|
|
|
<div class="chat-footer">
|
|
<input type="text" class="chat-input" id="textInput" data-i18n-placeholder="inputPlaceholder">
|
|
<i class="fas fa-paper-plane send-icon" onclick="sendMessage()"></i>
|
|
<i class="fas fa-microphone mic-icon" onclick="toggleMic()" id="micButton"></i>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="userCenterContent" style="display: none;">
|
|
<div class="user-center-container">
|
|
<div class="user-center-content">
|
|
<div id="profileSection" class="user-center-section">
|
|
<form id="profileForm">
|
|
<!-- 个人资料表单字段将在 JS 中动态添加 -->
|
|
</form>
|
|
</div>
|
|
<div id="apiKeySection" class="user-center-section">
|
|
<div id="apiKeyContent">
|
|
<!-- API 密钥内容将在 JS 中动态添加 -->
|
|
</div>
|
|
</div>
|
|
<div id="apiUsageSection" class="user-center-section">
|
|
<div id="apiUsageContent">
|
|
<!-- 模型调用内容将在 JS 中动态添加 -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
|
|
<div id="addUserModal" class="modal">
|
|
<div class="modal-content">
|
|
<span class="close" onclick="closeAddUserModal()">×</span>
|
|
<h2 data-i18n="addNewUser" style="margin-bottom: 30px;">添加新用户</h2>
|
|
<form id="addUserForm" autocomplete="off">
|
|
<div class="form-group">
|
|
<label for="name" data-i18n="name">姓名</label>
|
|
<input type="text" id="name" name="name" required autocomplete="off">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="password" data-i18n="password">密码</label>
|
|
<input id="password" name="password" required autocomplete="off">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="email" data-i18n="email">邮箱</label>
|
|
<input type="email" id="email" name="email" required autocomplete="off">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="phoneNumber" data-i18n="phoneNumber">手机号码</label>
|
|
<input type="tel" id="phoneNumber" name="phoneNumber" required autocomplete="off">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="role" data-i18n="role">角色</label>
|
|
<select id="role" name="role" required>
|
|
<option value="user" data-i18n="userRole">普通用户</option>
|
|
<option value="admin" data-i18n="adminRole">管理员</option>
|
|
</select>
|
|
</div>
|
|
<button type="submit" class="btn-mange" data-i18n="addUser">添加用户</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
|
|
const toggleSidebar = document.querySelector('.toggle-sidebar');
|
|
const sidebar = document.querySelector('.sidebar');
|
|
const mainContent = document.querySelector('.main-content');
|
|
|
|
toggleSidebar.addEventListener('click', () => {
|
|
sidebar.classList.toggle('open');
|
|
mainContent.classList.toggle('open');
|
|
});
|
|
// 在全局作用域定义 selectedLang
|
|
let selectedLang = 'zh'; // 默认语言为中文
|
|
|
|
// 语言切换
|
|
document.getElementById('languageSelector').addEventListener('change', function() {
|
|
selectedLang = this.value;
|
|
updateLanguage(lang[selectedLang]);
|
|
});
|
|
|
|
// 更新语言函数
|
|
function updateLanguage(langData) {
|
|
document.querySelectorAll('[data-i18n]').forEach(element => {
|
|
const key = element.getAttribute('data-i18n');
|
|
if (element.id === 'pageTitle') {
|
|
// 更新主页面标题
|
|
document.title = langData[key] || key;
|
|
} else {
|
|
// 更新其他元素的文本
|
|
element.textContent = langData[key] || key;
|
|
}
|
|
});
|
|
|
|
document.querySelectorAll('[data-i18n-placeholder]').forEach(element => {
|
|
const key = element.getAttribute('data-i18n-placeholder');
|
|
element.placeholder = langData[key] || key;
|
|
});
|
|
|
|
// 处理代码块中的翻译
|
|
document.querySelectorAll('pre code span[data-i18n]').forEach(element => {
|
|
const key = element.getAttribute('data-i18n');
|
|
element.textContent = langData[key] || key;
|
|
});
|
|
|
|
// 立即更新当前可见模块的标题
|
|
updateCurrentModuleTitle(langData);
|
|
}
|
|
|
|
// 新增函数:更新当前可见模块的标题
|
|
function updateCurrentModuleTitle(langData) {
|
|
const modules = [
|
|
{ id: 'chatContent', key: 'chatAssistant' },
|
|
{ id: 'featureContent', key: 'featureDemo' },
|
|
{ id: 'dashboardContent', key: 'dashboard' },
|
|
{ id: 'usersContent', key: 'userManagement' },
|
|
{ id: 'userCenterContent', key: 'userCenter' },
|
|
{ id: 'apiDocsContent', key: 'apiDocs' }
|
|
];
|
|
|
|
modules.forEach(module => {
|
|
const element = document.getElementById(module.id);
|
|
if (element && element.style.display !== 'none') {
|
|
const titleElement = element.querySelector('h2') || element.querySelector('h3');
|
|
if (titleElement) {
|
|
titleElement.textContent = langData[module.key] || module.key;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
// 语言切换
|
|
document.getElementById('languageSelector').addEventListener('change', function() {
|
|
selectedLang = this.value;
|
|
updateLanguage(lang[selectedLang]);
|
|
localStorage.setItem('selectedLang', selectedLang); // 保存选择的语言到本地存储
|
|
});
|
|
|
|
// 页面加载时初始化语言
|
|
window.addEventListener('load', () => {
|
|
selectedLang = localStorage.getItem('selectedLang') || 'zh'; // 从本地存储获取或使用默认值
|
|
document.getElementById('languageSelector').value = selectedLang;
|
|
updateLanguage(lang[selectedLang]);
|
|
});
|
|
|
|
// 主题切换
|
|
const themeToggle = document.getElementById('themeToggle');
|
|
themeToggle.addEventListener('click', () => {
|
|
document.body.classList.toggle('dark-mode');
|
|
themeToggle.innerHTML = document.body.classList.contains('dark-mode')
|
|
? '<i class="fas fa-sun"></i>'
|
|
: '<i class="fas fa-moon"></i>';
|
|
});
|
|
|
|
// 检查登录状态的函数
|
|
function checkLoginStatus() {
|
|
const token = localStorage.getItem('access_token');
|
|
if (!token) {
|
|
window.location.href = 'login.html'; // 重向到登录页面
|
|
}
|
|
}
|
|
|
|
// 页面加载时检查用户是否已登录
|
|
window.addEventListener('load', async () => {
|
|
if (!checkLoginStatus()) return;
|
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const token = urlParams.get('token') || localStorage.getItem('access_token');
|
|
if (token) {
|
|
localStorage.setItem('access_token', token);
|
|
await fetchUserInfo();
|
|
showChat();
|
|
} else {
|
|
updateUserDisplay();
|
|
}
|
|
|
|
// 初始化聊天助手
|
|
if (window.chatAssistant) {
|
|
await window.chatAssistant.initializeChat();
|
|
}
|
|
|
|
// 初始化用户中心
|
|
const navButtons = document.querySelectorAll('.user-center-nav-btn');
|
|
navButtons.forEach(button => {
|
|
button.addEventListener('click', () => {
|
|
const target = button.getAttribute('data-target');
|
|
showUserCenterSection(target);
|
|
});
|
|
});
|
|
|
|
// 初始化语言
|
|
updateLanguage(lang['zh']); // 默认使用中文
|
|
});
|
|
|
|
|
|
let isRecording = false;
|
|
|
|
window.sendMessage = async function() {
|
|
if (window.chatAssistant) {
|
|
await window.chatAssistant.sendTextMessage();
|
|
}
|
|
};
|
|
|
|
window.toggleMic = function() {
|
|
if (window.chatAssistant) {
|
|
window.chatAssistant.toggleMic();
|
|
} else {
|
|
const micButton = document.getElementById('micButton');
|
|
isRecording = !isRecording;
|
|
if (isRecording) {
|
|
micButton.classList.add('recording');
|
|
// 开始录音的逻辑
|
|
} else {
|
|
micButton.classList.remove('recording');
|
|
// 结束录音的逻辑
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
</body>
|
|
</html> |