Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
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
Unverified
Commit
f50298b8
authored
Jun 10, 2025
by
Archer
Committed by
GitHub
Jun 10, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: charts ux (#4986)
parent
101a6e95
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
+40
-2
projects/app/src/pageComponents/account/model/ModelDashboard/LineChartComponent.tsx
+4
-1
projects/app/src/pageComponents/account/model/ModelDashboard/index.tsx
+36
-1
No files found.
projects/app/src/pageComponents/account/model/ModelDashboard/LineChartComponent.tsx
View file @
f50298b8
...
...
@@ -62,7 +62,10 @@ const CustomTooltip = ({
}
})();
const
displayValue
=
item
.
formatter
?
item
.
formatter
(
value
)
:
formatNumber
(
value
);
const
displayValue
=
(()
=>
{
const
val
=
item
.
formatter
?
item
.
formatter
(
value
)
:
formatNumber
(
value
);
return
val
.
toLocaleString
();
})();
return
(
<
HStack
key=
{
index
}
fontSize=
{
'sm'
}
_notLast=
{
{
mb
:
1
}
}
>
...
...
projects/app/src/pageComponents/account/model/ModelDashboard/index.tsx
View file @
f50298b8
...
...
@@ -141,6 +141,41 @@ const ModelDashboard = ({ Tab }: { Tab: React.ReactNode }) => {
});
}
// Auto-fill missing days
if
(
filterProps
.
dateRange
.
from
&&
filterProps
.
dateRange
.
to
)
{
const
startDate
=
dayjs
(
filterProps
.
dateRange
.
from
);
const
endDate
=
dayjs
(
filterProps
.
dateRange
.
to
);
const
daysDiff
=
endDate
.
diff
(
startDate
,
'day'
)
+
1
;
// Create complete date list
const
completeDateList
=
Array
.
from
({
length
:
daysDiff
},
(
_
,
i
)
=>
startDate
.
add
(
i
,
'day'
)
);
// Create a map of existing data by timestamp
const
existingDataMap
=
new
Map
(
data
.
map
((
item
)
=>
[
dayjs
(
item
.
timestamp
*
1000
).
format
(
'YYYY-MM-DD'
),
item
])
);
// Fill missing days with empty data
const
completeData
=
completeDateList
.
map
((
date
)
=>
{
const
dateKey
=
date
.
format
(
'YYYY-MM-DD'
);
const
existingItem
=
existingDataMap
.
get
(
dateKey
);
if
(
existingItem
)
{
return
existingItem
;
}
else
{
// Create empty data structure for missing days
return
{
timestamp
:
Math
.
floor
(
date
.
valueOf
()
/
1000
),
models
:
[]
};
}
});
data
=
completeData
;
}
return
data
;
},
{
...
...
@@ -176,7 +211,7 @@ const ModelDashboard = ({ Tab }: { Tab: React.ReactNode }) => {
const
date
=
dayjs
(
item
.
timestamp
*
1000
).
format
(
'MM-DD'
);
const
totalCalls
=
item
.
models
.
reduce
((
acc
,
model
)
=>
acc
+
model
.
request_count
,
0
);
const
errorCalls
=
item
.
models
.
reduce
((
acc
,
model
)
=>
acc
+
model
.
exception_count
,
0
);
const
errorRate
=
Number
((
errorCalls
/
totalCalls
).
toFixed
(
2
));
const
errorRate
=
totalCalls
===
0
?
0
:
Number
((
errorCalls
/
totalCalls
).
toFixed
(
2
));
const
inputTokens
=
item
.
models
.
reduce
((
acc
,
model
)
=>
acc
+
(
model
?.
input_tokens
||
0
),
0
);
const
outputTokens
=
item
.
models
.
reduce
((
acc
,
model
)
=>
acc
+
(
model
?.
output_tokens
||
0
),
0
);
...
...
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