Skip to content

배포된 백엔드 api와 연결#47

Merged
7hyunii merged 14 commits intoSeq-Lab:developfrom
cnvxlns:api-connect
Feb 25, 2026
Merged

배포된 백엔드 api와 연결#47
7hyunii merged 14 commits intoSeq-Lab:developfrom
cnvxlns:api-connect

Conversation

@cnvxlns
Copy link
Copy Markdown
Collaborator

@cnvxlns cnvxlns commented Feb 24, 2026

  1. 기존에 있던 목데이터 제거
  2. 배포된 백엔드 api와의 연결
  3. step1 염기서열 입력 창에서 파일로 업로드 시 .fna 파일도 인식하도록 수정, 버튼 텍스트 Upload fasta->Upload as file로 문구 변경

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

기존 목(mock) 데이터/목 API를 제거하고, 배포된 백엔드(Primer design) 엔드포인트로 직접 요청을 보내도록 프론트엔드 네트워크 경로를 전환한 PR입니다. 또한 Step1 템플릿 서열 입력에서 파일 업로드 UX를 조정했습니다.

Changes:

  • 프라이머 설계 요청 경로를 /primer/design/design로 변경하고 axios baseURL을 배포 백엔드로 설정
  • Next.js rewrites 및 목 API route, 목 genome 데이터 제거/대체
  • Step1 파일 업로드에서 .fna 확장자 허용 및 버튼/안내 문구 변경, 빈 시퀀스 요청 방지 로직 추가

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/services/analysisService.ts 요청 payload 기본값/검색 범위 계산 조정 및 백엔드 /design로 호출 경로 변경
src/lib/api/primer.ts TanStack Query 훅이 사용하는 설계 API 호출 경로를 /design로 변경
src/lib/api/client.ts axios baseURL을 NEXT_PUBLIC_API_BASE_URL(기본값: 배포 서버)로 전환
next.config.ts /api/v1 rewrites 제거(빈 설정으로 단순화)
components/steps/Step1TemplateEssential.tsx 파일 업로드 확장자(.fna) 추가 및 버튼/설명 문구 변경
app/page.tsx 목 genome import 제거, 프리뷰용 상수로 대체 및 빈 시퀀스 요청 차단
src/lib/mocks/demoGenome.ts 목 genome 데이터 파일 제거
app/api/v1/primer/design/route.ts 목 API route 제거
.env.example 환경변수 안내를 NEXT_PUBLIC_API_BASE_URL 기준으로 변경

Comment on lines 3 to 9
const DEFAULT_API_BASE_URL = "https://primerflow-be.onrender.com";
const apiBaseUrl =
process.env.NEXT_PUBLIC_API_BASE_URL?.trim() || DEFAULT_API_BASE_URL;

export const apiClient = axios.create({
// 모든 API 호출을 /api/v1 이하 상대 경로로 강제합니다.
baseURL: "/api/v1",
baseURL: apiBaseUrl,
headers: {
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apiClient의 baseURL을 외부 도메인(https://primerflow-be.onrender.com)으로 직접 지정하면, 클라이언트 컴포넌트에서 호출 시 브라우저 CORS 정책의 영향을 받습니다(이전 rewrites 프록시와 동작이 달라짐). 백엔드에서 CORS 허용이 보장되지 않으면 호출이 실패하므로, (1) Next.js rewrites/프록시를 유지하거나 (2) Next API route를 프록시로 두는 방식으로 same-origin을 유지하는 방안을 검토해 주세요. 또한 기본값이 곧바로 배포 서버를 가리키므로 로컬 개발에서 의도치 않게 프로덕션을 호출할 수 있어, 로컬 기본값(예: localhost) 또는 환경변수 미설정 시 명시적 에러 처리도 고려할 만합니다.

Copilot uses AI. Check for mistakes.
Comment on lines +155 to +158
const targetSeq = validation.normalizedSequence?.trim() ?? "";
if (!targetSeq) {
setErrorMessage("Template sequence is required.");
return;
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기서 사용자에게 노출되는 에러 메시지가 영어로 표시되고 있는데, 같은 파일의 다른 검증/경고 메시지는 한국어로 제공되고 있습니다. 사용자 경험 일관성을 위해 한국어 메시지로 통일하거나(또는 i18n/상수로 분리) 기존 메시지 스타일에 맞춰 주세요.

Copilot uses AI. Check for mistakes.
Comment on lines 54 to 60
const toPrimerDesignRequest = (input: AnalyzeRequestInput): PrimerDesignRequest => {
const seq = input.target_sequence || input.templateSequence || "ATGC";
const seq = input.target_sequence || input.templateSequence || "";
const searchFrom = input.search_start ?? 1;
const searchTo =
input.search_end ??
searchFrom + (seq?.length || 1000);
searchFrom + Math.max(seq.length - 1, 0);

Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toPrimerDesignRequest에서 templateSequence 기본값을 빈 문자열로 변경하면서, 호출자가 실수로 시퀀스를 전달하지 않으면 그대로 빈 시퀀스/검색범위(from=to)가 백엔드로 전송될 수 있습니다. analyzeGenome 수준에서 templateSequence(또는 target_sequence)가 비어 있으면 요청 전에 명확한 에러를 throw 하거나, AnalyzeRequestInput 타입에서 해당 필드를 필수로 만들도록 정리하면 API 사용 실수를 조기에 잡을 수 있습니다.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@7hyunii 7hyunii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코파일럿 리뷰 3개 다 유의미한 리뷰 같아서 확인해보시는게 좋을 것 같습니다

@cnvxlns
Copy link
Copy Markdown
Collaborator Author

cnvxlns commented Feb 25, 2026

코파일럿 리뷰 3개 다 유의미한 리뷰 같아서 확인해보시는게 좋을 것 같습니다

해결하였습니다

@cnvxlns
Copy link
Copy Markdown
Collaborator Author

cnvxlns commented Feb 25, 2026

ci 안되는거 일단 좀만 있다가 고칠게요

@cnvxlns
Copy link
Copy Markdown
Collaborator Author

cnvxlns commented Feb 25, 2026

gpt왈 fort에서 보내는 pr은 secret에 접근할 수가 없다고 하여 시크릿값 요구 없이 그냥 url 하드코딩해서 때려박았습니다.

@7hyunii
Copy link
Copy Markdown
Contributor

7hyunii commented Feb 25, 2026

gpt왈 fort에서 보내는 pr은 secret에 접근할 수가 없다고 하여 시크릿값 요구 없이 그냥 url 하드코딩해서 때려박았습니다.

일단 크게 상관없는 거 같으니 머지하겠습니다

@7hyunii 7hyunii merged commit f46c949 into Seq-Lab:develop Feb 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants