diff --git a/controller/token.go b/controller/token.go index 8642122c..696ec4b4 100644 --- a/controller/token.go +++ b/controller/token.go @@ -109,7 +109,7 @@ func AddToken(c *gin.Context) { }) return } - if len(token.Name) > 30 { + if len(token.Name) > 50 { c.JSON(http.StatusOK, gin.H{ "success": false, "message": "令牌名称过长", @@ -171,7 +171,7 @@ func UpdateToken(c *gin.Context) { }) return } - if len(token.Name) > 30 { + if len(token.Name) > 50 { c.JSON(http.StatusOK, gin.H{ "success": false, "message": "令牌名称过长", diff --git a/web/src/components/LogsTable.js b/web/src/components/LogsTable.js index e311a520..8888a854 100644 --- a/web/src/components/LogsTable.js +++ b/web/src/components/LogsTable.js @@ -187,6 +187,13 @@ const LogsTable = () => { setLoading(false); }; + function formatTokenName(tokenName) { + if (tokenName.length <= 5) { + return tokenName; + } + return tokenName.slice(0, 5) + "..."; + } + return ( <> @@ -222,7 +229,7 @@ const LogsTable = () => { onClick={() => { sortLog('created_time'); }} - width={3} + width={2} > 时间 @@ -232,7 +239,7 @@ const LogsTable = () => { onClick={() => { sortLog('username'); }} - width={1} + width={2} > 用户 @@ -242,7 +249,7 @@ const LogsTable = () => { onClick={() => { sortLog('token_name'); }} - width={1} + width={2} > 令牌 @@ -296,7 +303,7 @@ const LogsTable = () => { onClick={() => { sortLog('content'); }} - width={isAdminUser ? 4 : 5} + width={3} > 详情 @@ -319,7 +326,7 @@ const LogsTable = () => { {log.username ? : ''} ) } - {log.token_name ? : ''} + {log.token_name ? : ''} {renderType(log.type)} {log.model_name ? : ''} {log.prompt_tokens ? log.prompt_tokens : ''} diff --git a/web/src/pages/Token/EditToken.js b/web/src/pages/Token/EditToken.js index 0ab37c29..784ff452 100644 --- a/web/src/pages/Token/EditToken.js +++ b/web/src/pages/Token/EditToken.js @@ -10,7 +10,7 @@ const EditToken = () => { const isEdit = tokenId !== undefined; const [loading, setLoading] = useState(isEdit); const originInputs = { - name: '', + name: '默认令牌', remain_quota: isEdit ? 0 : 500000, expired_time: -1, unlimited_quota: false