From 67f939bb981af88b1f40f21343ec62f4f9ae4fdf Mon Sep 17 00:00:00 2001 From: Monster <389264167@qq.com> Date: Fri, 18 Jul 2025 19:25:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E6=8E=92=E8=A1=8C=E6=A6=9C=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/api/OpenAiv1.ts | 24 ++++++++++++++++ ui/src/api/types.ts | 19 +++++++++++++ .../components/contributionModal.tsx | 15 ++++++---- .../dashboard/components/statisticCard.tsx | 28 ++++++++----------- 4 files changed, 63 insertions(+), 23 deletions(-) diff --git a/ui/src/api/OpenAiv1.ts b/ui/src/api/OpenAiv1.ts index 3a61f16..52ad1e6 100644 --- a/ui/src/api/OpenAiv1.ts +++ b/ui/src/api/OpenAiv1.ts @@ -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({ + path: `/v1/report`, + method: "POST", + body: param, + type: ContentType.Json, + format: "json", + ...params, + }); diff --git a/ui/src/api/types.ts b/ui/src/api/types.ts index 9b40a6a..d4e769e 100644 --- a/ui/src/api/types.ts +++ b/ui/src/api/types.ts @@ -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; } diff --git a/ui/src/pages/dashboard/components/contributionModal.tsx b/ui/src/pages/dashboard/components/contributionModal.tsx index ec7df4e..2f12003 100644 --- a/ui/src/pages/dashboard/components/contributionModal.tsx +++ b/ui/src/pages/dashboard/components/contributionModal.tsx @@ -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, }} > - {/* */} - - {item.username} - + - {item.lines} + {item.lines} 行 ))} diff --git a/ui/src/pages/dashboard/components/statisticCard.tsx b/ui/src/pages/dashboard/components/statisticCard.tsx index 5c64809..420fab5 100644 --- a/ui/src/pages/dashboard/components/statisticCard.tsx +++ b/ui/src/pages/dashboard/components/statisticCard.tsx @@ -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}`); - // }} > - {/* */} - - {item.username} + + {item.username} - {item.lines} + {item.lines} 行 ))}