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
10aa6808
authored
Oct 14, 2025
by
Seefs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: endpoint type log
parent
b3fc7255
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
104 deletions
+12
-104
web/src/components/table/usage-logs/UsageLogsColumnDefs.jsx
+1
-102
web/src/hooks/usage-logs/useUsageLogsData.jsx
+6
-0
web/src/i18n/locales/en.json
+1
-0
web/src/i18n/locales/fr.json
+2
-2
web/src/i18n/locales/ru.json
+1
-0
web/src/i18n/locales/zh.json
+1
-0
No files found.
web/src/components/table/usage-logs/UsageLogsColumnDefs.jsx
View file @
10aa6808
...
@@ -103,100 +103,6 @@ function renderType(type, t) {
...
@@ -103,100 +103,6 @@ function renderType(type, t) {
}
}
}
}
const
endpointColorMap
=
{
chat
:
'blue'
,
completions
:
'blue'
,
messages
:
'purple'
,
responses
:
'violet'
,
images
:
'pink'
,
image
:
'pink'
,
embeddings
:
'green'
,
embedding
:
'green'
,
audio
:
'teal'
,
speech
:
'teal'
,
translations
:
'teal'
,
transcriptions
:
'teal'
,
rerank
:
'cyan'
,
moderations
:
'red'
,
models
:
'orange'
,
engines
:
'orange'
,
mj
:
'red'
,
submit
:
'red'
,
suno
:
'amber'
,
realtime
:
'indigo'
,
notifications
:
'violet'
,
};
function
formatPathSegment
(
segment
)
{
if
(
!
segment
)
{
return
''
;
}
const
normalized
=
segment
.
replace
(
/^:/
,
''
).
replace
(
/
[
_-
]
/g
,
' '
);
return
normalized
.
split
(
' '
)
.
filter
(
Boolean
)
.
map
((
part
)
=>
part
.
charAt
(
0
).
toUpperCase
()
+
part
.
slice
(
1
))
.
join
(
' '
);
}
function
deriveEndpointMeta
(
path
)
{
if
(
!
path
)
{
return
null
;
}
const
cleanPath
=
path
.
split
(
'?'
)[
0
];
const
segments
=
cleanPath
.
split
(
'/'
).
filter
(
Boolean
);
if
(
segments
.
length
===
0
)
{
return
null
;
}
let
startIndex
=
0
;
if
(
/^v
\d
/i
.
test
(
segments
[
0
]))
{
startIndex
=
1
;
}
const
primary
=
segments
[
startIndex
]
||
segments
[
segments
.
length
-
1
];
const
tailSegments
=
segments
.
slice
(
startIndex
+
1
)
.
filter
((
segment
)
=>
segment
&&
!
segment
.
startsWith
(
':'
));
const
secondary
=
tailSegments
[
tailSegments
.
length
-
1
];
const
labelParts
=
[];
const
formattedPrimary
=
formatPathSegment
(
primary
);
if
(
formattedPrimary
)
{
labelParts
.
push
(
formattedPrimary
);
}
const
formattedSecondary
=
formatPathSegment
(
secondary
);
if
(
formattedSecondary
&&
formattedSecondary
!==
formattedPrimary
)
{
labelParts
.
push
(
formattedSecondary
);
}
const
label
=
labelParts
.
join
(
' · '
);
const
color
=
endpointColorMap
[
primary
]
||
(
secondary
?
endpointColorMap
[
secondary
]
:
undefined
)
||
'grey'
;
return
{
label
:
label
||
formatPathSegment
(
primary
),
color
,
};
}
function
renderEndpointTag
(
requestPath
)
{
const
meta
=
deriveEndpointMeta
(
requestPath
);
if
(
!
meta
)
{
return
null
;
}
const
tag
=
(
<
Tag
color=
{
meta
.
color
}
type=
'light'
shape=
'circle'
size=
'small'
>
{
meta
.
label
}
</
Tag
>
);
if
(
requestPath
)
{
return
<
Tooltip
content=
{
requestPath
}
>
{
tag
}
</
Tooltip
>;
}
return
tag
;
}
function
renderIsStream
(
bool
,
t
)
{
function
renderIsStream
(
bool
,
t
)
{
if
(
bool
)
{
if
(
bool
)
{
return
(
return
(
...
@@ -465,14 +371,7 @@ export const getLogsColumns = ({
...
@@ -465,14 +371,7 @@ export const getLogsColumns = ({
title
:
t
(
'类型'
),
title
:
t
(
'类型'
),
dataIndex
:
'type'
,
dataIndex
:
'type'
,
render
:
(
text
,
record
,
index
)
=>
{
render
:
(
text
,
record
,
index
)
=>
{
const
other
=
getLogOther
(
record
.
other
)
||
{};
return
<>
{
renderType
(
text
,
t
)
}
</>;
const
requestPath
=
other
.
request_path
;
return
(
<
Space
size=
'small'
wrap
>
{
renderType
(
text
,
t
)
}
{
renderEndpointTag
(
requestPath
)
}
</
Space
>
);
},
},
},
},
{
{
...
...
web/src/hooks/usage-logs/useUsageLogsData.jsx
View file @
10aa6808
...
@@ -468,6 +468,12 @@ export const useLogsData = () => {
...
@@ -468,6 +468,12 @@ export const useLogsData = () => {
});
});
}
}
}
}
if
(
other
?.
request_path
)
{
expandDataLocal
.
push
({
key
:
t
(
'请求路径'
),
value
:
other
.
request_path
,
});
}
expandDatesLocal
[
logs
[
i
].
key
]
=
expandDataLocal
;
expandDatesLocal
[
logs
[
i
].
key
]
=
expandDataLocal
;
}
}
...
...
web/src/i18n/locales/en.json
View file @
10aa6808
...
@@ -1675,6 +1675,7 @@
...
@@ -1675,6 +1675,7 @@
"请求失败"
:
"Request failed"
,
"请求失败"
:
"Request failed"
,
"请求头覆盖"
:
"Request header override"
,
"请求头覆盖"
:
"Request header override"
,
"请求并计费模型"
:
"Request and charge model"
,
"请求并计费模型"
:
"Request and charge model"
,
"请求路径"
:
"Request path"
,
"请求时长: ${time}s"
:
"Request time: ${time}s"
,
"请求时长: ${time}s"
:
"Request time: ${time}s"
,
"请求次数"
:
"Number of Requests"
,
"请求次数"
:
"Number of Requests"
,
"请求结束后多退少补"
:
"Adjust after request completion"
,
"请求结束后多退少补"
:
"Adjust after request completion"
,
...
...
web/src/i18n/locales/fr.json
View file @
10aa6808
...
@@ -1684,6 +1684,7 @@
...
@@ -1684,6 +1684,7 @@
"请求失败"
:
"Échec de la demande"
,
"请求失败"
:
"Échec de la demande"
,
"请求头覆盖"
:
"Remplacement des en-têtes de demande"
,
"请求头覆盖"
:
"Remplacement des en-têtes de demande"
,
"请求并计费模型"
:
"Modèle de demande et de facturation"
,
"请求并计费模型"
:
"Modèle de demande et de facturation"
,
"请求路径"
:
"Chemin de requête"
,
"请求时长: ${time}s"
:
"Durée de la requête : ${time}s"
,
"请求时长: ${time}s"
:
"Durée de la requête : ${time}s"
,
"请求次数"
:
"Nombre de demandes"
,
"请求次数"
:
"Nombre de demandes"
,
"请求结束后多退少补"
:
"Ajuster après la fin de la demande"
,
"请求结束后多退少补"
:
"Ajuster après la fin de la demande"
,
...
@@ -2081,4 +2082,4 @@
...
@@ -2081,4 +2082,4 @@
"默认测试模型"
:
"Modèle de test par défaut"
,
"默认测试模型"
:
"Modèle de test par défaut"
,
"默认补全倍率"
:
"Taux de complétion par défaut"
"默认补全倍率"
:
"Taux de complétion par défaut"
}
}
}
}
\ No newline at end of file
web/src/i18n/locales/ru.json
View file @
10aa6808
...
@@ -1693,6 +1693,7 @@
...
@@ -1693,6 +1693,7 @@
"请求失败"
:
"Запрос не удался"
,
"请求失败"
:
"Запрос не удался"
,
"请求头覆盖"
:
"Переопределение заголовков запроса"
,
"请求头覆盖"
:
"Переопределение заголовков запроса"
,
"请求并计费模型"
:
"Запрос и выставление счёта модели"
,
"请求并计费模型"
:
"Запрос и выставление счёта модели"
,
"请求路径"
:
"Путь запроса"
,
"请求时长: ${time}s"
:
"Время запроса: ${time}s"
,
"请求时长: ${time}s"
:
"Время запроса: ${time}s"
,
"请求次数"
:
"Количество запросов"
,
"请求次数"
:
"Количество запросов"
,
"请求结束后多退少补"
:
"После вывода запроса возврат излишков и доплата недостатка"
,
"请求结束后多退少补"
:
"После вывода запроса возврат излишков и доплата недостатка"
,
...
...
web/src/i18n/locales/zh.json
View file @
10aa6808
...
@@ -1666,6 +1666,7 @@
...
@@ -1666,6 +1666,7 @@
"请求失败"
:
"请求失败"
,
"请求失败"
:
"请求失败"
,
"请求头覆盖"
:
"请求头覆盖"
,
"请求头覆盖"
:
"请求头覆盖"
,
"请求并计费模型"
:
"请求并计费模型"
,
"请求并计费模型"
:
"请求并计费模型"
,
"请求路径"
:
"请求路径"
,
"请求时长: ${time}s"
:
"请求时长: ${time}s"
,
"请求时长: ${time}s"
:
"请求时长: ${time}s"
,
"请求次数"
:
"请求次数"
,
"请求次数"
:
"请求次数"
,
"请求结束后多退少补"
:
"请求结束后多退少补"
,
"请求结束后多退少补"
:
"请求结束后多退少补"
,
...
...
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