feat: log search field request_id

This commit is contained in:
Seefs
2026-02-04 02:12:18 +08:00
parent 1ee80930d4
commit dd467ed592
4 changed files with 37 additions and 8 deletions

View File

@@ -93,6 +93,15 @@ const LogsFilters = ({
size='small'
/>
<Form.Input
field='request_id'
prefix={<IconSearch />}
placeholder={t('Request ID')}
showClear
pure
size='small'
/>
{isAdminUser && (
<>
<Form.Input

View File

@@ -94,6 +94,7 @@ export const useLogsData = () => {
model_name: '',
channel: '',
group: '',
request_id: '',
dateRange: [
timestamp2string(getTodayStartTimestamp()),
timestamp2string(now.getTime() / 1000 + 3600),
@@ -230,6 +231,7 @@ export const useLogsData = () => {
end_timestamp,
channel: formValues.channel || '',
group: formValues.group || '',
request_id: formValues.request_id || '',
logType: formValues.logType ? parseInt(formValues.logType) : 0,
};
};
@@ -348,6 +350,12 @@ export const useLogsData = () => {
value: `${logs[i].channel} - ${logs[i].channel_name || '[未知]'}`,
});
}
if (logs[i].request_id) {
expandDataLocal.push({
key: t('Request ID'),
value: logs[i].request_id,
});
}
if (other?.ws || other?.audio) {
expandDataLocal.push({
key: t('语音输入'),
@@ -620,6 +628,7 @@ export const useLogsData = () => {
end_timestamp,
channel,
group,
request_id,
logType: formLogType,
} = getFormValues();
@@ -633,9 +642,9 @@ export const useLogsData = () => {
let localStartTimestamp = Date.parse(start_timestamp) / 1000;
let localEndTimestamp = Date.parse(end_timestamp) / 1000;
if (isAdminUser) {
url = `/api/log/?p=${startIdx}&page_size=${pageSize}&type=${currentLogType}&username=${username}&token_name=${token_name}&model_name=${model_name}&start_timestamp=${localStartTimestamp}&end_timestamp=${localEndTimestamp}&channel=${channel}&group=${group}`;
url = `/api/log/?p=${startIdx}&page_size=${pageSize}&type=${currentLogType}&username=${username}&token_name=${token_name}&model_name=${model_name}&start_timestamp=${localStartTimestamp}&end_timestamp=${localEndTimestamp}&channel=${channel}&group=${group}&request_id=${request_id}`;
} else {
url = `/api/log/self/?p=${startIdx}&page_size=${pageSize}&type=${currentLogType}&token_name=${token_name}&model_name=${model_name}&start_timestamp=${localStartTimestamp}&end_timestamp=${localEndTimestamp}&group=${group}`;
url = `/api/log/self/?p=${startIdx}&page_size=${pageSize}&type=${currentLogType}&token_name=${token_name}&model_name=${model_name}&start_timestamp=${localStartTimestamp}&end_timestamp=${localEndTimestamp}&group=${group}&request_id=${request_id}`;
}
url = encodeURI(url);
const res = await API.get(url);