Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7b203eb5
authored
Nov 05, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 美化日志页面
(cherry picked from commit 90daa38d5bea7b158ebed9990f042f6bf8567eb3)
parent
6ae98047
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
60 deletions
+74
-60
web/src/components/LogsTable.js
+74
-60
No files found.
web/src/components/LogsTable.js
View file @
7b203eb5
...
@@ -336,33 +336,33 @@ const LogsTable = () => {
...
@@ -336,33 +336,33 @@ const LogsTable = () => {
);
);
},
},
},
},
//
{
{
//
title: '重试',
title
:
'重试'
,
//
dataIndex: 'retry',
dataIndex
:
'retry'
,
//
className: isAdmin() ? 'tableShow' : 'tableHiddle',
className
:
isAdmin
()
?
'tableShow'
:
'tableHiddle'
,
//
render: (text, record, index) => {
render
:
(
text
,
record
,
index
)
=>
{
//
let content = '渠道:' + record.channel;
let
content
=
'渠道:'
+
record
.
channel
;
//
if (record.other !== '') {
if
(
record
.
other
!==
''
)
{
//
let other = JSON.parse(record.other);
let
other
=
JSON
.
parse
(
record
.
other
);
//
if (other === null) {
if
(
other
===
null
)
{
//
return <></>;
return
<><
/>
;
//
}
}
//
if (other.admin_info !== undefined) {
if
(
other
.
admin_info
!==
undefined
)
{
//
if (
if
(
//
other.admin_info.use_channel !== null &&
other
.
admin_info
.
use_channel
!==
null
&&
//
other.admin_info.use_channel !== undefined &&
other
.
admin_info
.
use_channel
!==
undefined
&&
//
other.admin_info.use_channel !== ''
other
.
admin_info
.
use_channel
!==
''
//
) {
)
{
//
// channel id array
// channel id array
//
let useChannel = other.admin_info.use_channel;
let
useChannel
=
other
.
admin_info
.
use_channel
;
//
let useChannelStr = useChannel.join('->');
let
useChannelStr
=
useChannel
.
join
(
'->'
);
//
content = `渠道:${useChannelStr}`;
content
=
`渠道:
${
useChannelStr
}
`
;
//
}
}
//
}
}
//
}
}
//
return isAdminUser ? <div>{content}</div> : <></>;
return
isAdminUser
?
<
div
>
{
content
}
<
/div> : <></
>
;
//
},
},
//
},
},
{
{
title
:
'详情'
,
title
:
'详情'
,
dataIndex
:
'content'
,
dataIndex
:
'content'
,
...
@@ -384,25 +384,24 @@ const LogsTable = () => {
...
@@ -384,25 +384,24 @@ const LogsTable = () => {
<
/Paragraph
>
<
/Paragraph
>
);
);
}
}
let
content
=
renderModelPrice
(
record
.
prompt_tokens
,
// let content = renderModelPrice(
record
.
completion_tokens
,
// record.prompt_tokens,
other
.
model_ratio
,
// record.completion_tokens,
other
.
model_price
,
// other.model_ratio,
other
.
completion_ratio
,
// other.model_price,
other
.
group_ratio
,
// other.completion_ratio,
);
// other.group_ratio,
// );
return
(
return
(
<
Tooltip
content
=
{
content
}
>
<
Paragraph
<
Paragraph
ellipsis
=
{{
ellipsis
=
{{
rows
:
2
,
rows
:
2
,
}}
}}
style
=
{{
maxWidth
:
240
}}
style
=
{{
maxWidth
:
240
}}
>
>
{
text
}
调用消费
<
/Paragraph
>
<
/Paragraph
>
<
/Tooltip
>
);
);
},
},
},
},
...
@@ -520,23 +519,23 @@ const LogsTable = () => {
...
@@ -520,23 +519,23 @@ const LogsTable = () => {
let
other
=
getLogOther
(
logs
[
i
].
other
);
let
other
=
getLogOther
(
logs
[
i
].
other
);
let
expandDataLocal
=
[];
let
expandDataLocal
=
[];
if
(
isAdmin
())
{
if
(
isAdmin
())
{
let
content
=
'渠道:'
+
logs
[
i
].
channel
;
//
let content = '渠道:' + logs[i].channel;
if
(
other
.
admin_info
!==
undefined
)
{
//
if (other.admin_info !== undefined) {
if
(
//
if (
other
.
admin_info
.
use_channel
!==
null
&&
//
other.admin_info.use_channel !== null &&
other
.
admin_info
.
use_channel
!==
undefined
&&
//
other.admin_info.use_channel !== undefined &&
other
.
admin_info
.
use_channel
!==
''
//
other.admin_info.use_channel !== ''
)
{
//
) {
// channel id array
//
// channel id array
let
useChannel
=
other
.
admin_info
.
use_channel
;
//
let useChannel = other.admin_info.use_channel;
let
useChannelStr
=
useChannel
.
join
(
'->'
);
//
let useChannelStr = useChannel.join('->');
content
=
`渠道:
${
useChannelStr
}
`
;
//
content = `渠道:${useChannelStr}`;
}
//
}
}
//
}
expandDataLocal
.
push
({
//
expandDataLocal.push({
key
:
'渠道重试'
,
//
key: '渠道重试',
value
:
content
,
//
value: content,
})
//
})
}
}
if
(
other
?.
ws
)
{
if
(
other
?.
ws
)
{
expandDataLocal
.
push
({
expandDataLocal
.
push
({
...
@@ -557,9 +556,24 @@ const LogsTable = () => {
...
@@ -557,9 +556,24 @@ const LogsTable = () => {
});
});
}
}
expandDataLocal
.
push
({
expandDataLocal
.
push
({
key
:
'
倍率
详情'
,
key
:
'
日志
详情'
,
value
:
logs
[
i
].
content
,
value
:
logs
[
i
].
content
,
})
})
if
(
logs
[
i
].
type
===
2
)
{
let
content
=
renderModelPrice
(
logs
[
i
].
prompt_tokens
,
logs
[
i
].
completion_tokens
,
other
.
model_ratio
,
other
.
model_price
,
other
.
completion_ratio
,
other
.
group_ratio
,
);
expandDataLocal
.
push
({
key
:
'计费过程'
,
value
:
content
,
});
}
expandDatesLocal
[
logs
[
i
].
key
]
=
expandDataLocal
;
expandDatesLocal
[
logs
[
i
].
key
]
=
expandDataLocal
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment