fix: agent token gen errorr
This commit is contained in:
@@ -399,6 +399,33 @@ input[type="number"]:hover::-webkit-inner-spin-button {
|
|||||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 17 5 5 5-5'/%3E%3Cpath d='m7 7 5-5 5 5'/%3E%3C/svg%3E");
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 17 5 5 5-5'/%3E%3Cpath d='m7 7 5-5 5 5'/%3E%3C/svg%3E");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Date/Time picker enhancement */
|
||||||
|
input[type="datetime-local"],
|
||||||
|
input[type="date"],
|
||||||
|
input[type="time"] {
|
||||||
|
color-scheme: light;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark input[type="datetime-local"],
|
||||||
|
.dark input[type="date"],
|
||||||
|
.dark input[type="time"] {
|
||||||
|
color-scheme: dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
|
||||||
|
input[type="date"]::-webkit-calendar-picker-indicator,
|
||||||
|
input[type="time"]::-webkit-calendar-picker-indicator {
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.5;
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator,
|
||||||
|
input[type="date"]:hover::-webkit-calendar-picker-indicator,
|
||||||
|
input[type="time"]:hover::-webkit-calendar-picker-indicator {
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
/* Custom scrollbar styles */
|
/* Custom scrollbar styles */
|
||||||
.custom-scrollbar::-webkit-scrollbar {
|
.custom-scrollbar::-webkit-scrollbar {
|
||||||
width: 6px;
|
width: 6px;
|
||||||
|
|||||||
@@ -141,10 +141,15 @@ function copyToken(token: string) {
|
|||||||
|
|
||||||
async function createToken() {
|
async function createToken() {
|
||||||
try {
|
try {
|
||||||
|
let expiresAt = tokenForm.value.expires_at
|
||||||
|
if (expiresAt) {
|
||||||
|
// 适配后端格式: 2006-01-02 15:04:05
|
||||||
|
expiresAt = expiresAt.replace('T', ' ') + ':00'
|
||||||
|
}
|
||||||
await api.agents.createToken({
|
await api.agents.createToken({
|
||||||
remark: tokenForm.value.remark,
|
remark: tokenForm.value.remark,
|
||||||
max_uses: tokenForm.value.max_uses,
|
max_uses: tokenForm.value.max_uses,
|
||||||
expires_at: tokenForm.value.expires_at || undefined
|
expires_at: expiresAt || undefined
|
||||||
})
|
})
|
||||||
showTokenDialog.value = false
|
showTokenDialog.value = false
|
||||||
tokenForm.value = { remark: '', max_uses: 0, expires_at: '' }
|
tokenForm.value = { remark: '', max_uses: 0, expires_at: '' }
|
||||||
@@ -167,7 +172,9 @@ async function deleteToken(id: string) {
|
|||||||
|
|
||||||
function isTokenExpired(token: AgentToken) {
|
function isTokenExpired(token: AgentToken) {
|
||||||
if (!token.expires_at) return false
|
if (!token.expires_at) return false
|
||||||
return new Date(token.expires_at) < new Date()
|
// 将 "YYYY-MM-DD HH:mm:ss" 转换为 ISO 格式 "YYYY-MM-DDTHH:mm:ss" 以提高浏览器兼容性
|
||||||
|
const dateStr = token.expires_at.replace(' ', 'T')
|
||||||
|
return new Date(dateStr) < new Date()
|
||||||
}
|
}
|
||||||
|
|
||||||
function isTokenExhausted(token: AgentToken) {
|
function isTokenExhausted(token: AgentToken) {
|
||||||
|
|||||||
Reference in New Issue
Block a user