fix: 修正后台管理模板API路径为 /api/admin/xxx
This commit is contained in:
@@ -142,8 +142,8 @@
|
|||||||
// 加载数据
|
// 加载数据
|
||||||
async function loadData() {
|
async function loadData() {
|
||||||
const [providersRes, profilesRes] = await Promise.all([
|
const [providersRes, profilesRes] = await Promise.all([
|
||||||
fetch('/api/providers'),
|
fetch('/api/admin/providers'),
|
||||||
fetch('/api/auto-profiles')
|
fetch('/api/admin/auto-profiles')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
providers = await providersRes.json();
|
providers = await providersRes.json();
|
||||||
|
|||||||
+3
-3
@@ -142,7 +142,7 @@
|
|||||||
|
|
||||||
// 加载模型列表
|
// 加载模型列表
|
||||||
async function loadModels() {
|
async function loadModels() {
|
||||||
const res = await fetch('/api/chat/models');
|
const res = await fetch('/api/admin/chat/models');
|
||||||
models = await res.json();
|
models = await res.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
|
|
||||||
// 加载对话列表
|
// 加载对话列表
|
||||||
async function loadChats() {
|
async function loadChats() {
|
||||||
const res = await fetch('/api/chat/list');
|
const res = await fetch('/api/admin/chat/list');
|
||||||
chats = await res.json();
|
chats = await res.json();
|
||||||
renderChatList();
|
renderChatList();
|
||||||
}
|
}
|
||||||
@@ -292,7 +292,7 @@
|
|||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/chat/send', {
|
const res = await fetch('/api/admin/chat/send', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
async function loadConfig() {
|
async function loadConfig() {
|
||||||
const res = await fetch('/api/config');
|
const res = await fetch('/api/admin/config');
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
const container = document.getElementById('configContent');
|
const container = document.getElementById('configContent');
|
||||||
|
|||||||
@@ -178,7 +178,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
async function loadStats() {
|
async function loadStats() {
|
||||||
const res = await fetch('/api/stats');
|
const res = await fetch('/api/admin/stats');
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
document.getElementById('stat-requests').textContent = data.total_requests;
|
document.getElementById('stat-requests').textContent = data.total_requests;
|
||||||
@@ -194,7 +194,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadProviders() {
|
async function loadProviders() {
|
||||||
const res = await fetch('/api/providers');
|
const res = await fetch('/api/admin/providers');
|
||||||
const providers = await res.json();
|
const providers = await res.json();
|
||||||
|
|
||||||
const container = document.getElementById('providerList');
|
const container = document.getElementById('providerList');
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
async function loadLogs() {
|
async function loadLogs() {
|
||||||
const res = await fetch('/api/logs');
|
const res = await fetch('/api/admin/logs');
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
const container = document.getElementById('logContent');
|
const container = document.getElementById('logContent');
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
async function loadModels() {
|
async function loadModels() {
|
||||||
const res = await fetch('/api/models');
|
const res = await fetch('/api/admin/models');
|
||||||
const models = await res.json();
|
const models = await res.json();
|
||||||
|
|
||||||
const tbody = document.getElementById('modelTable');
|
const tbody = document.getElementById('modelTable');
|
||||||
|
|||||||
@@ -166,7 +166,7 @@
|
|||||||
|
|
||||||
// 加载提供商列表
|
// 加载提供商列表
|
||||||
async function loadProviders() {
|
async function loadProviders() {
|
||||||
const res = await fetch('/api/providers');
|
const res = await fetch('/api/admin/providers');
|
||||||
providers = await res.json();
|
providers = await res.json();
|
||||||
|
|
||||||
const container = document.getElementById('providerList');
|
const container = document.getElementById('providerList');
|
||||||
@@ -304,7 +304,7 @@
|
|||||||
const order = [...cards].map(card => card.dataset.id);
|
const order = [...cards].map(card => card.dataset.id);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/providers/priority', {
|
const res = await fetch('/api/admin/providers/priority', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ order })
|
body: JSON.stringify({ order })
|
||||||
@@ -394,7 +394,7 @@
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 新增
|
// 新增
|
||||||
res = await fetch('/api/providers', {
|
res = await fetch('/api/admin/providers', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(data)
|
body: JSON.stringify(data)
|
||||||
|
|||||||
Reference in New Issue
Block a user