1. 增加了模型管理页面的功能

2. 修改了若干的bug
This commit is contained in:
2026-01-20 16:16:13 +08:00
parent bfaeb24d9e
commit fa9c976f28
5 changed files with 347 additions and 72 deletions

View File

@@ -2,8 +2,10 @@
API 路由包 API 路由包
""" """
from .datasets import datasets_bp from .datasets import datasets_bp
from .model_manage import model_manage_bp
# 注册所有蓝图 # 注册所有蓝图
def register_blueprints(app): def register_blueprints(app):
"""注册所有蓝图""" """注册所有蓝图"""
app.register_blueprint(datasets_bp) app.register_blueprint(datasets_bp)
app.register_blueprint(model_manage_bp)

145
src/api/model_manage.py Normal file
View File

@@ -0,0 +1,145 @@
"""
模型管理 API 路由
"""
import os
import pymysql
import yaml
from flask import Blueprint, request, jsonify
# 获取项目根目录
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# 创建蓝图
model_manage_bp = Blueprint('model_manage', __name__, url_prefix='/api/model-manage')
def get_db_connection():
"""获取数据库连接"""
CONFIG_PATH = os.path.join(PROJECT_ROOT, 'config.yaml')
with open(CONFIG_PATH, 'r', encoding='utf-8') as f:
CONFIG = yaml.safe_load(f)
db_config = CONFIG['database']
return pymysql.connect(
host=db_config['host'],
port=db_config['port'],
user=db_config['username'],
password=db_config['password'],
database=db_config['name'],
charset=db_config.get('charset', 'utf8mb4'),
cursorclass=pymysql.cursors.DictCursor
)
def generic_get_all(table_name, order_by='create_time DESC'):
"""通用查询所有"""
conn = get_db_connection()
cursor = conn.cursor()
cursor.execute(f"SELECT * FROM {table_name} ORDER BY {order_by}")
result = cursor.fetchall()
cursor.close()
conn.close()
return result
def generic_create(table_name, data):
"""通用创建"""
conn = get_db_connection()
cursor = conn.cursor()
columns = ', '.join(data.keys())
placeholders = ', '.join(['%s'] * len(data))
sql = f"INSERT INTO {table_name} ({columns}) VALUES ({placeholders})"
cursor.execute(sql, list(data.values()))
conn.commit()
new_id = cursor.lastrowid
cursor.close()
conn.close()
return new_id
def generic_update(table_name, id_val, data):
"""通用更新"""
conn = get_db_connection()
cursor = conn.cursor()
set_clause = ', '.join([f"{k} = %s" for k in data.keys()])
sql = f"UPDATE {table_name} SET {set_clause} WHERE id = %s"
values = list(data.values()) + [id_val]
cursor.execute(sql, values)
conn.commit()
cursor.close()
conn.close()
def generic_delete(table_name, id_val):
"""通用删除"""
conn = get_db_connection()
cursor = conn.cursor()
cursor.execute(f"DELETE FROM {table_name} WHERE id = %s", (id_val,))
conn.commit()
cursor.close()
conn.close()
def generic_get_by_id(table_name, id_val):
"""通用按ID查询"""
conn = get_db_connection()
cursor = conn.cursor()
cursor.execute(f"SELECT * FROM {table_name} WHERE id = %s", (id_val,))
result = cursor.fetchone()
cursor.close()
conn.close()
return result
# ============ 模型管理 CRUD ============
@model_manage_bp.route('', methods=['GET'])
def get_model_manage():
"""获取所有模型"""
return jsonify({'code': 0, 'data': generic_get_all('model_manage')})
@model_manage_bp.route('/<int:id>', methods=['GET'])
def get_model_manage_by_id(id):
"""获取单个模型"""
model = generic_get_by_id('model_manage', id)
if model:
return jsonify({'code': 0, 'data': model})
return jsonify({'code': 1, 'message': '模型不存在'})
@model_manage_bp.route('', methods=['POST'])
def create_model_manage():
"""创建模型"""
data = request.json
# 构建插入数据
insert_data = {
'name': data.get('name'),
'type': data.get('type'),
'model_source': data.get('model_source', 'local'),
'description': data.get('description')
}
if data.get('model_source') == 'local':
insert_data['path'] = data.get('path', '')
else:
insert_data['api_url'] = data.get('api_url', '')
insert_data['api_key'] = data.get('api_key', '')
insert_data['model_name'] = data.get('model_name', '')
new_id = generic_create('model_manage', insert_data)
return jsonify({'code': 0, 'message': '创建成功', 'id': new_id})
@model_manage_bp.route('/<int:id>', methods=['PUT'])
def update_model_manage(id):
"""更新模型"""
data = request.json
generic_update('model_manage', id, data)
return jsonify({'code': 0, 'message': '更新成功'})
@model_manage_bp.route('/<int:id>', methods=['DELETE'])
def delete_model_manage(id):
"""删除模型"""
generic_delete('model_manage', id)
return jsonify({'code': 0, 'message': '删除成功'})

View File

@@ -157,8 +157,11 @@ def init_database():
id INT AUTO_INCREMENT PRIMARY KEY, id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL,
type VARCHAR(100), type VARCHAR(100),
version VARCHAR(50), model_source VARCHAR(20) DEFAULT 'local',
path VARCHAR(500), path VARCHAR(500),
api_url VARCHAR(500),
api_key VARCHAR(500),
model_name VARCHAR(255),
description TEXT, description TEXT,
create_time DATETIME DEFAULT CURRENT_TIMESTAMP, create_time DATETIME DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
@@ -456,32 +459,6 @@ def delete_permission(id):
return jsonify({'code': 0, 'message': '删除成功'}) return jsonify({'code': 0, 'message': '删除成功'})
# ============ 模型管理接口 ============
@app.route('/api/model-manage', methods=['GET'])
def get_model_manage():
return jsonify({'code': 0, 'data': generic_get_all('model_manage')})
@app.route('/api/model-manage', methods=['POST'])
def create_model_manage():
data = request.json
new_id = generic_create('model_manage', data)
return jsonify({'code': 0, 'message': '创建成功', 'id': new_id})
@app.route('/api/model-manage/<int:id>', methods=['PUT'])
def update_model_manage(id):
data = request.json
generic_update('model_manage', id, data)
return jsonify({'code': 0, 'message': '更新成功'})
@app.route('/api/model-manage/<int:id>', methods=['DELETE'])
def delete_model_manage(id):
generic_delete('model_manage', id)
return jsonify({'code': 0, 'message': '删除成功'})
# ============ 系统配置接口 ============ # ============ 系统配置接口 ============
@app.route('/api/sys-config', methods=['GET']) @app.route('/api/sys-config', methods=['GET'])
def get_sys_config(): def get_sys_config():

View File

@@ -217,10 +217,12 @@
<div class="flex items-center space-x-4"> <div class="flex items-center space-x-4">
<div class="relative group"> <div class="relative group">
<img src="https://picsum.photos/id/1005/32/32" class="w-8 h-8 rounded-full cursor-pointer" alt="用户头像"> <img src="https://picsum.photos/id/1005/32/32" class="w-8 h-8 rounded-full cursor-pointer" alt="用户头像">
<div class="absolute right-0 top-full mt-1 bg-white rounded shadow-lg py-1 hidden group-hover:block border border-gray-100 min-w-[140px] z-50"> <div class="absolute right-0 top-full pt-2 hidden group-hover:block z-50">
<a href="login.html" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 whitespace-nowrap"> <div class="bg-white rounded shadow-lg py-1 border border-gray-100 min-w-[140px]">
<i class="fa fa-sign-out mr-1"></i>退出登录 <a href="login.html" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 whitespace-nowrap">
</a> <i class="fa fa-sign-out mr-1"></i>退出登录
</a>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -309,12 +311,24 @@
createText: '上传数据集', createText: '上传数据集',
columns: [ columns: [
{ title: '数据集名称', key: 'name' }, { title: '数据集名称', key: 'name' },
{ title: '类型', key: 'type' }, { title: '数据类型', key: 'type', render: (val) => {
const textMap = {
'train': '训练数据',
'test': '测试数据',
'val': '验证数据',
'other': '其他'
};
const displayText = textMap[val?.toLowerCase()] || val || '-';
return '<span class="px-2 py-1 rounded text-xs bg-blue-100 text-blue-700">' + displayText + '</span>';
}},
{ title: '存储位置', key: 'storage_type', render: (val) => { { title: '存储位置', key: 'storage_type', render: (val) => {
if (val === 'local') return '<span class="px-2 py-1 rounded text-xs bg-blue-100 text-blue-700">本地存储</span>'; const textMap = {
if (val === 'minio') return '<span class="px-2 py-1 rounded text-xs bg-orange-100 text-orange-700">MinIO</span>'; 'local': '本地存储',
if (val === 'cloud') return '<span class="px-2 py-1 rounded text-xs bg-green-100 text-green-700">云存储</span>'; 'minio': 'MinIO',
return '<span class="px-2 py-1 rounded text-xs bg-gray-100 text-gray-700">' + (val || '-') + '</span>'; 'cloud': '云存储'
};
const displayText = textMap[val] || val || '-';
return '<span class="px-2 py-1 rounded text-xs bg-green-100 text-green-700">' + displayText + '</span>';
}}, }},
{ title: '大小', key: 'size', render: (val) => (val && val !== '0 B' && val !== '0') ? val : '-' }, { title: '大小', key: 'size', render: (val) => (val && val !== '0 B' && val !== '0') ? val : '-' },
{ title: '数据条数', key: 'count', render: (val) => val || 0 }, { title: '数据条数', key: 'count', render: (val) => val || 0 },
@@ -340,9 +354,25 @@
createText: '添加模型', createText: '添加模型',
columns: [ columns: [
{ title: '模型名称', key: 'name' }, { title: '模型名称', key: 'name' },
{ title: '模型类型', key: 'type' }, { title: '模型类型', key: 'type', render: (val) => {
{ title: '模型版本', key: 'version' }, const textMap = {
{ title: '模型路径', key: 'path', render: (val) => val || '-' }, 'LLM': '大语言模型',
'CV': '计算机视觉',
'NLP': '自然语言处理',
'Embedding': '向量模型',
'Other': '其他'
};
const displayText = textMap[val] || val || '-';
return '<span class="px-2 py-1 rounded text-xs bg-blue-100 text-blue-700">' + displayText + '</span>';
}},
{ title: '模型来源', key: 'model_source', render: (val) => {
const textMap = {
'local': '本地模型',
'online': '在线模型'
};
const displayText = textMap[val] || val || '-';
return '<span class="px-2 py-1 rounded text-xs bg-green-100 text-green-700">' + displayText + '</span>';
}},
{ title: '描述', key: 'description', render: (val) => val || '-' }, { title: '描述', key: 'description', render: (val) => val || '-' },
{ title: '创建时间', key: 'create_time', render: (val) => val ? new Date(val).toLocaleString('zh-CN') : '-' } { title: '创建时间', key: 'create_time', render: (val) => val ? new Date(val).toLocaleString('zh-CN') : '-' }
], ],
@@ -383,8 +413,30 @@
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
const pageParam = urlParams.get('page'); const pageParam = urlParams.get('page');
// 加载页面优先使用URL参数 // 确定加载页面
const defaultPage = pageParam || 'fine-tune'; let defaultPage = 'fine-tune'; // 默认页面
if (pageParam) {
// URL有参数优先使用URL参数
defaultPage = pageParam;
} else {
// 没有URL参数使用 sessionStorage 或 localStorage
// 优先使用 sessionStorage仅当前会话有效
const sessionPage = sessionStorage.getItem('lastPage');
const localPage = localStorage.getItem('lastPage');
const savedPage = sessionPage || localPage;
if (savedPage && tableConfigs[savedPage]) {
defaultPage = savedPage;
}
// 否则保持默认 'fine-tune'
}
// 保存到 sessionStorage当前会话
sessionStorage.setItem('lastPage', defaultPage);
console.log('Page init - URL param:', pageParam, 'saved:', sessionStorage.getItem('lastPage'), 'loading:', defaultPage);
loadPage(defaultPage); loadPage(defaultPage);
// 更新侧边栏高亮状态 // 更新侧边栏高亮状态
@@ -405,6 +457,10 @@
const page = this.dataset.page; const page = this.dataset.page;
loadPage(page); loadPage(page);
// 保存当前页面到 sessionStorage当前会话有效关闭浏览器后失效
sessionStorage.setItem('lastPage', page);
localStorage.setItem('lastPage', page); // 同时保存到 localStorage
// 更新高亮状态 // 更新高亮状态
document.querySelectorAll('.nav-link').forEach(l => { document.querySelectorAll('.nav-link').forEach(l => {
l.classList.remove('sidebar-item-active'); l.classList.remove('sidebar-item-active');
@@ -495,6 +551,9 @@
if (api === 'dataset-manage') { if (api === 'dataset-manage') {
// 跳转到数据集创建页面进行编辑 // 跳转到数据集创建页面进行编辑
window.location.href = `dataset-create.html?id=${id}`; window.location.href = `dataset-create.html?id=${id}`;
} else if (api === 'model-manage') {
// 跳转到模型创建页面进行编辑
window.location.href = `model-manage-create.html?id=${id}`;
} else { } else {
showMessage('提示', '编辑功能开发中...', 'info'); showMessage('提示', '编辑功能开发中...', 'info');
} }
@@ -508,6 +567,26 @@
window.open(`${baseUrl}/api/dataset-manage/download/${datasetId}`, '_blank'); window.open(`${baseUrl}/api/dataset-manage/download/${datasetId}`, '_blank');
} }
// 筛选表格
function filterTable() {
const searchInput = document.getElementById('tableSearchInput');
if (!searchInput) return;
const keyword = searchInput.value.toLowerCase().trim();
const tbody = document.querySelector('#page-content table tbody');
if (!tbody) return;
const rows = tbody.querySelectorAll('tr');
rows.forEach(row => {
const text = row.querySelector('td')?.textContent?.toLowerCase() || '';
if (keyword === '' || text.includes(keyword)) {
row.style.display = '';
} else {
row.style.display = 'none';
}
});
}
// 渲染表格页面 // 渲染表格页面
function renderTablePage(config, data) { function renderTablePage(config, data) {
const createButton = config.hasCreate ? ` const createButton = config.hasCreate ? `
@@ -516,6 +595,16 @@
</button> </button>
` : ''; ` : '';
// 搜索框(模型管理和数据集管理)
const searchBox = (config.api === 'model-manage' || config.api === 'dataset-manage') ? `
<div class="relative">
<input type="text" id="tableSearchInput" placeholder="搜索${config.title}..."
class="w-72 pl-9 pr-3 py-1.5 rounded border border-gray-300 text-sm focus:outline-none focus:border-primary focus:ring-1 focus:border-primary"
oninput="filterTable()">
<i class="fa fa-search absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
</div>
` : '';
const columns = config.columns; const columns = config.columns;
const hasData = data && data.length > 0; const hasData = data && data.length > 0;
@@ -524,6 +613,7 @@
<div class="flex items-center justify-between p-4 border-b border-gray-100"> <div class="flex items-center justify-between p-4 border-b border-gray-100">
<h2 class="text-lg font-medium">${config.title}</h2> <h2 class="text-lg font-medium">${config.title}</h2>
<div class="flex items-center space-x-3"> <div class="flex items-center space-x-3">
${searchBox}
${createButton} ${createButton}
</div> </div>
</div> </div>
@@ -1079,8 +1169,12 @@
// 页面加载后初始化并启动定时器 // 页面加载后初始化并启动定时器
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
initGPUList(); // 只在平台性能页面初始化GPU列表
startRefreshTimer(); const gpuCountEl = document.getElementById('gpuCount');
if (gpuCountEl) {
initGPUList();
startRefreshTimer();
}
}); });
function saveConfig() { function saveConfig() {

View File

@@ -178,8 +178,7 @@
<span class="text-red-500 mr-1">*</span>模型类型 <span class="text-red-500 mr-1">*</span>模型类型
</label> </label>
<select name="type" class="form-input"> <select name="type" class="form-input">
<option value="">请选择</option> <option value="LLM" selected>大语言模型 (LLM)</option>
<option value="LLM">大语言模型 (LLM)</option>
<option value="CV">计算机视觉 (CV)</option> <option value="CV">计算机视觉 (CV)</option>
<option value="NLP">自然语言处理 (NLP)</option> <option value="NLP">自然语言处理 (NLP)</option>
<option value="Embedding">向量模型 (Embedding)</option> <option value="Embedding">向量模型 (Embedding)</option>
@@ -189,25 +188,11 @@
</div> </div>
</div> </div>
<!-- 版本信息 -->
<div class="mb-6"> <div class="mb-6">
<h3 class="text-sm font-semibold text-gray-700 mb-4 pb-2 border-b border-gray-100">版本信息</h3> <h3 class="text-sm font-semibold text-gray-700 mb-4 pb-2 border-b border-gray-100">模型来源</h3>
<div class="max-w-md">
<label class="form-label">
<span class="text-red-500 mr-1">*</span>模型版本
</label>
<input type="text" name="version" class="form-input" placeholder="如v1.0.0" maxlength="50">
<p class="text-xs text-gray-400 mt-1">建议使用语义化版本号v1.0.0、v2.1.0</p>
</div>
</div>
<!-- 模型路径 -->
<div class="mb-6">
<h3 class="text-sm font-semibold text-gray-700 mb-4 pb-2 border-b border-gray-100">模型路径</h3>
<!-- 模型来源选择 --> <!-- 模型来源选择 -->
<div class="mb-4"> <div class="mb-4">
<label class="block text-sm text-gray-600 mb-3">模型来源</label>
<div class="flex items-center space-x-6"> <div class="flex items-center space-x-6">
<label class="flex items-center cursor-pointer"> <label class="flex items-center cursor-pointer">
<input type="radio" name="model_source" value="local" checked class="mr-2" onchange="toggleModelSource('local')"> <input type="radio" name="model_source" value="local" checked class="mr-2" onchange="toggleModelSource('local')">
@@ -291,18 +276,42 @@
// 返回页面 // 返回页面
let backUrl = 'main.html?page=model-manage'; let backUrl = 'main.html?page=model-manage';
// 编辑模式
let isEditMode = false;
let editId = null;
// 页面加载完成后初始化 // 页面加载完成后初始化
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
// 根据URL参数设置返回页面 // 根据URL参数设置返回页面
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
const from = urlParams.get('from'); const from = urlParams.get('from');
const id = urlParams.get('id');
const breadcrumbParent = document.getElementById('breadcrumbParent'); const breadcrumbParent = document.getElementById('breadcrumbParent');
if (from === 'fine-tune') { if (from === 'fine-tune') {
backUrl = 'fine-tune-create.html'; backUrl = 'fine-tune-create.html';
if (breadcrumbParent) { if (breadcrumbParent) {
breadcrumbParent.textContent = '创建训练任务'; breadcrumbParent.textContent = '创建训练任务';
} }
} }
// 编辑模式
if (id) {
isEditMode = true;
editId = parseInt(id);
// 修改标题
if (breadcrumbParent) {
breadcrumbParent.textContent = '模型管理';
}
// 修改按钮文字
const saveBtn = document.querySelector('button[onclick="submitForm()"]');
if (saveBtn) {
saveBtn.innerHTML = '<i class="fa fa-check mr-2"></i>保存修改';
}
// 加载模型数据
loadModelData(editId);
}
// 描述字数统计 // 描述字数统计
const descInput = document.querySelector('textarea[name="description"]'); const descInput = document.querySelector('textarea[name="description"]');
if (descInput) { if (descInput) {
@@ -322,6 +331,45 @@
}); });
}); });
// 加载模型数据(编辑模式)
async function loadModelData(id) {
try {
const response = await fetch(`${API_BASE}/model-manage/${id}`);
const result = await response.json();
if (result.code === 0 && result.data) {
const model = result.data;
// 填充表单
document.querySelector('input[name="name"]').value = model.name || '';
document.querySelector('select[name="type"]').value = model.type || 'LLM';
// 设置模型来源
const modelSource = model.model_source || 'local';
document.querySelectorAll('input[name="model_source"]').forEach(radio => {
radio.checked = radio.value === modelSource;
});
// 根据来源显示对应面板
toggleModelSource(modelSource);
// 填充来源相关字段
if (modelSource === 'local') {
document.querySelector('input[name="local_path"]').value = model.path || '';
} else {
document.querySelector('input[name="api_url"]').value = model.api_url || '';
document.querySelector('input[name="api_key"]').value = model.api_key || '';
document.querySelector('input[name="online_model_name"]').value = model.model_name || '';
}
// 填充描述
const descInput = document.querySelector('textarea[name="description"]');
descInput.value = model.description || '';
document.getElementById('descCount').textContent = descInput.value.length;
}
} catch (error) {
console.error('加载模型数据失败:', error);
}
}
// 切换模型来源 // 切换模型来源
function toggleModelSource(source) { function toggleModelSource(source) {
const localPanel = document.getElementById('localModelPanel'); const localPanel = document.getElementById('localModelPanel');
@@ -337,14 +385,15 @@
// 提交表单 // 提交表单
async function submitForm() { async function submitForm() {
console.log('submitForm called');
const form = document.getElementById('modelForm'); const form = document.getElementById('modelForm');
const formData = new FormData(form); const formData = new FormData(form);
const modelSource = formData.get('model_source'); const modelSource = formData.get('model_source');
console.log('modelSource:', modelSource);
const data = { const data = {
name: formData.get('name'), name: formData.get('name'),
type: formData.get('type'), type: formData.get('type'),
version: formData.get('version'),
model_source: modelSource, model_source: modelSource,
description: formData.get('description') description: formData.get('description')
}; };
@@ -383,27 +432,37 @@
showMessage('提示', '请选择模型类型', 'warning'); showMessage('提示', '请选择模型类型', 'warning');
return; return;
} }
if (!data.version) {
showMessage('提示', '请输入模型版本', 'warning');
return;
}
try { try {
const response = await fetch(`${API_BASE}/model-manage`, { let url = `${API_BASE}/model-manage`;
method: 'POST', let method = 'POST';
let successMsg = '模型添加成功!';
if (isEditMode) {
url = `${API_BASE}/model-manage/${editId}`;
method = 'PUT';
successMsg = '模型修改成功!';
}
console.log('Sending request to:', url);
console.log('Request data:', data);
const response = await fetch(url, {
method: method,
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data) body: JSON.stringify(data)
}); });
console.log('Response status:', response.status);
const result = await response.json(); const result = await response.json();
console.log('Response data:', result);
if (result.code === 0) { if (result.code === 0) {
showMessage('成功', '模型添加成功!', 'success', () => { showMessage('成功', successMsg, 'success', () => {
window.location.href = 'main.html?page=model-manage'; window.location.href = 'main.html?page=model-manage';
}); });
} else { } else {
showMessage('错误', result.message || '添加失败', 'error'); showMessage('错误', result.message || '操作失败', 'error');
} }
} catch (error) { } catch (error) {
showMessage('错误', '添加失败: ' + error.message, 'error'); showMessage('错误', '操作失败: ' + error.message, 'error');
} }
} }
@@ -414,7 +473,6 @@
const modalMessage = document.getElementById('modalMessage'); const modalMessage = document.getElementById('modalMessage');
const modalIcon = document.getElementById('modalIcon'); const modalIcon = document.getElementById('modalIcon');
const modalConfirmBtn = document.getElementById('modalConfirmBtn2'); const modalConfirmBtn = document.getElementById('modalConfirmBtn2');
const modalBtnGroup = document.getElementById('modalBtnGroup');
const modalSingleBtnGroup = document.getElementById('modalSingleBtnGroup'); const modalSingleBtnGroup = document.getElementById('modalSingleBtnGroup');
modalTitle.textContent = title; modalTitle.textContent = title;
@@ -430,7 +488,6 @@
modalIcon.innerHTML = '<div class="w-12 h-12 mx-auto mb-4 rounded-full bg-blue-100 flex items-center justify-center"><i class="fa fa-info text-xl text-blue-600"></i></div>'; modalIcon.innerHTML = '<div class="w-12 h-12 mx-auto mb-4 rounded-full bg-blue-100 flex items-center justify-center"><i class="fa fa-info text-xl text-blue-600"></i></div>';
} }
modalBtnGroup.classList.add('hidden');
modalSingleBtnGroup.classList.remove('hidden'); modalSingleBtnGroup.classList.remove('hidden');
modalConfirmBtn.className = type === 'error' ? 'px-6 py-2 bg-danger text-white rounded-lg hover:bg-danger/90 transition-colors' : 'px-6 py-2 bg-primary text-white rounded-lg hover:bg-primary/90 transition-colors'; modalConfirmBtn.className = type === 'error' ? 'px-6 py-2 bg-danger text-white rounded-lg hover:bg-danger/90 transition-colors' : 'px-6 py-2 bg-primary text-white rounded-lg hover:bg-primary/90 transition-colors';