Skip to content

Commit 67f939b

Browse files
committed
给排行榜加了头像
1 parent 3f4d4cf commit 67f939b

File tree

4 files changed

+63
-23
lines changed

4 files changed

+63
-23
lines changed

ui/src/api/OpenAiv1.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import request, { ContentType, RequestParams } from "./httpClient";
1414
import {
1515
DomainAcceptCompletionReq,
1616
DomainModelListResp,
17+
DomainReportReq,
1718
WebResp,
1819
} from "./types";
1920

@@ -122,3 +123,26 @@ export const getModelList = (params: RequestParams = {}) =>
122123
format: "json",
123124
...params,
124125
});
126+
127+
/**
128+
* @description 报告
129+
*
130+
* @tags OpenAIV1
131+
* @name PostReport
132+
* @summary 报告
133+
* @request POST:/v1/report
134+
* @response `200` `WebResp` OK
135+
*/
136+
137+
export const postReport = (
138+
param: DomainReportReq,
139+
params: RequestParams = {},
140+
) =>
141+
request<WebResp>({
142+
path: `/v1/report`,
143+
method: "POST",
144+
body: param,
145+
type: ContentType.Json,
146+
format: "json",
147+
...params,
148+
});

ui/src/api/types.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ export enum ConstsUserPlatform {
2222
UserPlatformCustom = "custom",
2323
}
2424

25+
export enum ConstsReportAction {
26+
ReportActionAccept = "accept",
27+
ReportActionSuggest = "suggest",
28+
ReportActionFileWritten = "file_written",
29+
}
30+
2531
export enum ConstsModelType {
2632
ModelTypeLLM = "llm",
2733
ModelTypeCoder = "coder",
@@ -51,6 +57,7 @@ export enum ConstsModelProvider {
5157
export enum ConstsChatRole {
5258
ChatRoleUser = "user",
5359
ChatRoleAssistant = "assistant",
60+
ChatRoleSystem = "system",
5461
}
5562

5663
export enum ConstsAdminStatus {
@@ -480,6 +487,16 @@ export interface DomainRegisterReq {
480487
username: string;
481488
}
482489

490+
export interface DomainReportReq {
491+
action?: ConstsReportAction;
492+
/** 内容 */
493+
content?: string;
494+
/** task_id or resp_id */
495+
id?: string;
496+
/** 工具 */
497+
tool?: string;
498+
}
499+
483500
export interface DomainSetting {
484501
/** 创建时间 */
485502
created_at?: number;
@@ -639,6 +656,8 @@ export interface DomainUser {
639656
export interface DomainUserCodeRank {
640657
/** 代码行数 */
641658
lines?: number;
659+
/** 用户信息 */
660+
user?: DomainUser;
642661
/** 用户名 */
643662
username?: string;
644663
}

ui/src/pages/dashboard/components/contributionModal.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Box, Stack } from '@mui/material';
22
import { DomainUserCodeRank } from '@/api/types';
33
import { Modal } from '@c-x/ui';
4-
import { StyledItem, StyledSerialNumber, StyledText } from './statisticCard';
4+
import { StyledItem, StyledSerialNumber } from './statisticCard';
5+
import User from '@/components/user';
56

67
const ContributionModal = ({
78
open,
@@ -47,13 +48,15 @@ const ContributionModal = ({
4748
minWidth: 0,
4849
}}
4950
>
50-
{/* <Avatar size={24} src={item.avatar} /> */}
51-
<StyledText className='active-user-name'>
52-
{item.username}
53-
</StyledText>
51+
<User
52+
id={item.user?.id}
53+
username={item.user?.username}
54+
email={item.user?.email}
55+
avatar={item.user?.avatar_url}
56+
deleted={item.user?.is_deleted} />
5457
</Stack>
5558
</StyledItem>
56-
<Box sx={{ fontSize: 14 }}>{item.lines}</Box>
59+
<Box sx={{ fontSize: 14 }}>{item.lines}</Box>
5760
</Stack>
5861
))}
5962
</Box>

ui/src/pages/dashboard/components/statisticCard.tsx

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React, { useState } from 'react';
2-
import { styled, Stack, Box, Button } from '@mui/material';
1+
import { useState } from 'react';
2+
import { styled, Stack, Box } from '@mui/material';
33
import { Empty } from '@c-x/ui';
44
import dayjs from 'dayjs';
55
import { useNavigate } from 'react-router-dom';
@@ -12,6 +12,7 @@ import {
1212
DomainUserCodeRank,
1313
DomainUserEvent,
1414
} from '@/api/types';
15+
import Avatar from '@/components/avatar';
1516

1617
const StyledCardLabel = styled('div')(({ theme }) => ({
1718
fontSize: '14px',
@@ -122,26 +123,19 @@ export const ContributionCard = ({
122123
gap={1.5}
123124
sx={{
124125
flex: 1,
125-
minWidth: 0,
126-
// cursor: 'pointer',
127-
// '&:hover': {
128-
// '.active-user-name': {
129-
// color: 'primary.main',
130-
// },
131-
// },
126+
minWidth: 0
132127
}}
133-
// onClick={() => {
134-
// navigate(`/`)
135-
// // window.open(`/discussion/user/${item.id}`);
136-
// }}
137128
>
138-
{/* <Avatar size={24} src={item.avatar} /> */}
139-
<StyledText className='active-user-name'>
140-
{item.username}
129+
<Avatar
130+
name={item.user?.username}
131+
src={item.user?.avatar_url}
132+
sx={{ width: 20, height: 20, fontSize: 12 }}
133+
/>
134+
<StyledText className='active-user-name'>{item.username}
141135
</StyledText>
142136
</Stack>
143137
</StyledItem>
144-
<Box sx={{ fontSize: 14 }}>{item.lines}</Box>
138+
<Box sx={{ fontSize: 14 }}>{item.lines}</Box>
145139
</Stack>
146140
))}
147141
</Box>

0 commit comments

Comments
 (0)