feat: add client ip for berry theme

This commit is contained in:
林水溶 2024-03-14 00:19:55 +09:00
parent 0b0a8fba28
commit 0e8103527d
5 changed files with 30 additions and 2 deletions

View File

@ -14,6 +14,7 @@ const LogTableHead = ({ userIsAdmin }) => {
<TableCell>提示</TableCell> <TableCell>提示</TableCell>
<TableCell>补全</TableCell> <TableCell>补全</TableCell>
<TableCell>额度</TableCell> <TableCell>额度</TableCell>
<TableCell>请求端IP</TableCell>
<TableCell>详情</TableCell> <TableCell>详情</TableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>

View File

@ -57,6 +57,7 @@ export default function LogTableRow({ item, userIsAdmin }) {
<TableCell>{item.prompt_tokens || ''}</TableCell> <TableCell>{item.prompt_tokens || ''}</TableCell>
<TableCell>{item.completion_tokens || ''}</TableCell> <TableCell>{item.completion_tokens || ''}</TableCell>
<TableCell>{item.quota ? renderQuota(item.quota, 6) : ''}</TableCell> <TableCell>{item.quota ? renderQuota(item.quota, 6) : ''}</TableCell>
<TableCell>{item.client_ip || ''}</TableCell>
<TableCell>{item.content}</TableCell> <TableCell>{item.content}</TableCell>
</TableRow> </TableRow>
</> </>

View File

@ -5,6 +5,7 @@ import {
IconKey, IconKey,
IconBrandGithubCopilot, IconBrandGithubCopilot,
IconSitemap, IconSitemap,
IconMapPin
} from "@tabler/icons-react"; } from "@tabler/icons-react";
import { import {
InputAdornment, InputAdornment,
@ -81,6 +82,30 @@ export default function TableToolBar({
/> />
</FormControl> </FormControl>
<FormControl>
<InputLabel htmlFor="channel-client_ip-label">请求端IP</InputLabel>
<OutlinedInput
id="client_ip"
name="client_ip"
sx={{
minWidth: "100%",
}}
label="请求端IP"
value={filterName.client_ip}
onChange={handleFilterName}
placeholder="请求端IP"
startAdornment={
<InputAdornment position="start">
<IconMapPin
stroke={1.5}
size="20px"
color={grey500}
/>
</InputAdornment>
}
/>
</FormControl>
<FormControl> <FormControl>
<LocalizationProvider <LocalizationProvider
dateAdapter={AdapterDayjs} dateAdapter={AdapterDayjs}

View File

@ -28,7 +28,8 @@ export default function Log() {
start_timestamp: 0, start_timestamp: 0,
end_timestamp: new Date().getTime() / 1000 + 3600, end_timestamp: new Date().getTime() / 1000 + 3600,
type: 0, type: 0,
channel: '' channel: '',
client_ip: ''
}; };
const [logs, setLogs] = useState([]); const [logs, setLogs] = useState([]);
const [activePage, setActivePage] = useState(0); const [activePage, setActivePage] = useState(0);

View File

@ -425,7 +425,7 @@ const LogsTable = () => {
}} }}
width={1} width={1}
> >
请求IP 请求IP
</Table.HeaderCell> </Table.HeaderCell>
<Table.HeaderCell <Table.HeaderCell
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}