给排行榜加了头像

This commit is contained in:
Monster
2025-07-18 19:25:53 +08:00
parent 3f4d4cf609
commit 67f939bb98
4 changed files with 63 additions and 23 deletions

View File

@@ -14,6 +14,7 @@ import request, { ContentType, RequestParams } from "./httpClient";
import {
DomainAcceptCompletionReq,
DomainModelListResp,
DomainReportReq,
WebResp,
} from "./types";
@@ -122,3 +123,26 @@ export const getModelList = (params: RequestParams = {}) =>
format: "json",
...params,
});
/**
* @description 报告
*
* @tags OpenAIV1
* @name PostReport
* @summary 报告
* @request POST:/v1/report
* @response `200` `WebResp` OK
*/
export const postReport = (
param: DomainReportReq,
params: RequestParams = {},
) =>
request<WebResp>({
path: `/v1/report`,
method: "POST",
body: param,
type: ContentType.Json,
format: "json",
...params,
});

View File

@@ -22,6 +22,12 @@ export enum ConstsUserPlatform {
UserPlatformCustom = "custom",
}
export enum ConstsReportAction {
ReportActionAccept = "accept",
ReportActionSuggest = "suggest",
ReportActionFileWritten = "file_written",
}
export enum ConstsModelType {
ModelTypeLLM = "llm",
ModelTypeCoder = "coder",
@@ -51,6 +57,7 @@ export enum ConstsModelProvider {
export enum ConstsChatRole {
ChatRoleUser = "user",
ChatRoleAssistant = "assistant",
ChatRoleSystem = "system",
}
export enum ConstsAdminStatus {
@@ -480,6 +487,16 @@ export interface DomainRegisterReq {
username: string;
}
export interface DomainReportReq {
action?: ConstsReportAction;
/** 内容 */
content?: string;
/** task_id or resp_id */
id?: string;
/** 工具 */
tool?: string;
}
export interface DomainSetting {
/** 创建时间 */
created_at?: number;
@@ -639,6 +656,8 @@ export interface DomainUser {
export interface DomainUserCodeRank {
/** 代码行数 */
lines?: number;
/** 用户信息 */
user?: DomainUser;
/** 用户名 */
username?: string;
}

View File

@@ -1,7 +1,8 @@
import { Box, Stack } from '@mui/material';
import { DomainUserCodeRank } from '@/api/types';
import { Modal } from '@c-x/ui';
import { StyledItem, StyledSerialNumber, StyledText } from './statisticCard';
import { StyledItem, StyledSerialNumber } from './statisticCard';
import User from '@/components/user';
const ContributionModal = ({
open,
@@ -47,13 +48,15 @@ const ContributionModal = ({
minWidth: 0,
}}
>
{/* <Avatar size={24} src={item.avatar} /> */}
<StyledText className='active-user-name'>
{item.username}
</StyledText>
<User
id={item.user?.id}
username={item.user?.username}
email={item.user?.email}
avatar={item.user?.avatar_url}
deleted={item.user?.is_deleted} />
</Stack>
</StyledItem>
<Box sx={{ fontSize: 14 }}>{item.lines}</Box>
<Box sx={{ fontSize: 14 }}>{item.lines} </Box>
</Stack>
))}
</Box>

View File

@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { styled, Stack, Box, Button } from '@mui/material';
import { useState } from 'react';
import { styled, Stack, Box } from '@mui/material';
import { Empty } from '@c-x/ui';
import dayjs from 'dayjs';
import { useNavigate } from 'react-router-dom';
@@ -12,6 +12,7 @@ import {
DomainUserCodeRank,
DomainUserEvent,
} from '@/api/types';
import Avatar from '@/components/avatar';
const StyledCardLabel = styled('div')(({ theme }) => ({
fontSize: '14px',
@@ -122,26 +123,19 @@ export const ContributionCard = ({
gap={1.5}
sx={{
flex: 1,
minWidth: 0,
// cursor: 'pointer',
// '&:hover': {
// '.active-user-name': {
// color: 'primary.main',
// },
// },
minWidth: 0
}}
// onClick={() => {
// navigate(`/`)
// // window.open(`/discussion/user/${item.id}`);
// }}
>
{/* <Avatar size={24} src={item.avatar} /> */}
<StyledText className='active-user-name'>
{item.username}
<Avatar
name={item.user?.username}
src={item.user?.avatar_url}
sx={{ width: 20, height: 20, fontSize: 12 }}
/>
<StyledText className='active-user-name'>{item.username}
</StyledText>
</Stack>
</StyledItem>
<Box sx={{ fontSize: 14 }}>{item.lines}</Box>
<Box sx={{ fontSize: 14 }}>{item.lines} </Box>
</Stack>
))}
</Box>