Refactor: 모델 isDefault 타입 추가 및 평가 모델 리스트에서 활용

This commit is contained in:
정현조 2024-09-26 16:00:01 +09:00
parent 6edb302fb1
commit ef56a71623
3 changed files with 8 additions and 3 deletions

View File

@ -6,6 +6,7 @@ import useModelResultsQuery from '@/queries/models/useModelResultsQuery';
import ModelBarChart from './ModelBarChart';
import ModelLineChart from './ModelLineChart';
import { useState } from 'react';
import { ModelResponse } from '@/types';
interface EvaluationTabProps {
projectId: number | null;
@ -33,7 +34,7 @@ export default function EvaluationTab({ projectId }: EvaluationTabProps) {
}
interface ModelSelectionProps {
models: Array<{ id: number; name: string }> | undefined;
models: ModelResponse[] | undefined;
setSelectedModel: (modelId: number) => void;
}
@ -50,6 +51,7 @@ function ModelSelection({ models, setSelectedModel }: ModelSelectionProps) {
<SelectItem
key={model.id}
value={model.id.toString()}
disabled={model.isDefault}
>
{model.name}
</SelectItem>

View File

@ -24,6 +24,7 @@ export const modelHandlers = [
const updatedModel: ModelResponse = {
id: modelId,
name: modelData.name,
isDefault: false,
};
return HttpResponse.json(updatedModel);
@ -51,8 +52,8 @@ export const modelHandlers = [
console.log(projectId);
const models: ProjectModelsResponse = [
{ id: 1, name: 'Model 1' },
{ id: 2, name: 'Model 2' },
{ id: 1, name: 'Model 1', isDefault: true },
{ id: 2, name: 'Model 2', isDefault: false },
];
return HttpResponse.json(models);
@ -70,6 +71,7 @@ export const modelHandlers = [
const newModel: ModelResponse = {
id: Math.floor(Math.random() * 1000), // 임의로 ID 생성
name: modelData.name,
isDefault: false,
};
return HttpResponse.json(newModel);

View File

@ -308,6 +308,7 @@ export interface ModelRequest {
export interface ModelResponse {
id: number;
name: string;
isDefault: boolean;
}
// 프로젝트 모델 리스트 응답 DTO