Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const JdInputPageClient = forwardRef<
>(function JdInputPageClient({ selectedMethod, onMethodChange }, ref) {
const { mockApplyId: id } = useParams<{ mockApplyId: string }>();
const router = useRouter();
const manualJdReviewPath = `/mockApply/actual/${id}/jd-review?mode=manual`;
const manualJdReviewPath = `/mockApply/${id}/jd-review?mode=manual`;
const activeRequestIdRef = useRef(0);

const [isTextModalOpen, setIsTextModalOpen] = useState(false);
Expand Down Expand Up @@ -248,15 +248,47 @@ const JdInputPageClient = forwardRef<

const moveToJdReviewWithResult = (status: JobPostingIngestStatus) => {
const result = status.result;
const jobPosting = result?.generated ?? result?.extracted;

if (!jobPosting) {
throw new Error("추출된 공고 정보를 확인할 수 없습니다.");
const generated = result?.generated;
const extracted = result?.extracted;
const saved = result?.saved;
const classification = result?.classification;
const firstNonEmpty = (...values: Array<string | null | undefined>) =>
values.find((value) => value?.trim())?.trim() ?? "";
const jobPosting = {
companyName: firstNonEmpty(
generated?.companyName,
extracted?.companyName,
saved?.companyName,
),
jobTitle: firstNonEmpty(
saved?.jobTitle,
generated?.jobTitle,
extracted?.jobTitle,
classification?.detailClassificationName,
),
task: firstNonEmpty(generated?.task, extracted?.task, saved?.task),
requirements: firstNonEmpty(
generated?.requirements,
extracted?.requirements,
saved?.requirement,
),
preferredQualifications: firstNonEmpty(
generated?.preferredQualifications,
extracted?.preferredQualifications,
saved?.preferred,
),
};

if (!Object.values(jobPosting).some(Boolean)) {
throw new Error(
result?.message ||
"이미지에서 공고 정보를 추출하지 못했습니다. 더 선명한 이미지를 사용해주세요.",
);
}
Comment on lines +282 to 287

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fallback error message is image-specific but this path also handles text/link.

moveToJdReviewWithResult is invoked for text, link, and image ingestion. When result?.message is absent and no fields were extracted, text/link users will see the image-only guidance. Consider a source-agnostic default.

💬 Proposed tweak
     if (!Object.values(jobPosting).some(Boolean)) {
       throw new Error(
         result?.message ||
-          "이미지에서 공고 정보를 추출하지 못했습니다. 더 선명한 이미지를 사용해주세요.",
+          "공고 정보를 추출하지 못했습니다. 다른 방법으로 공고 내용을 입력해주세요.",
       );
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!Object.values(jobPosting).some(Boolean)) {
throw new Error(
result?.message ||
"이미지에서 공고 정보를 추출하지 못했습니다. 더 선명한 이미지를 사용해주세요.",
);
}
if (!Object.values(jobPosting).some(Boolean)) {
throw new Error(
result?.message ||
"공고 정보를 추출하지 못했습니다. 다른 방법으로 공고 내용을 입력해주세요.",
);
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@jobdri/src/app/mockApply/`[mockApplyId]/(jd)/jd-input/JdInputPageClient.tsx
around lines 282 - 287, Update the fallback error message in
moveToJdReviewWithResult to be source-agnostic, since the no-extracted-fields
path handles text, link, and image ingestion. Preserve result?.message when
available and replace only the image-specific default with guidance applicable
to all ingestion sources.


const detailClassificationId =
result?.saved?.detailClassificationId ??
result?.classification?.detailClassificationId ??
saved?.detailClassificationId ??
classification?.detailClassificationId ??
result?.candidates?.[0]?.detailClassificationId ??
0;

Expand All @@ -267,21 +299,24 @@ const JdInputPageClient = forwardRef<
window.sessionStorage.setItem(
getJdReviewMetadataStorageKey(id),
JSON.stringify({
companySize: result?.saved?.companySize ?? "STARTUP",
companySize: saved?.companySize ?? "STARTUP",
detailClassificationId,
profileColor: saved?.profileColor ?? "DEFAULT",
postingName: firstNonEmpty(saved?.postingName, jobPosting.jobTitle),
jobTitle: jobPosting.jobTitle,
}),
);

if (result?.saved) {
if (saved) {
window.sessionStorage.setItem(
getJdReviewSavedStorageKey(id),
JSON.stringify(result.saved),
JSON.stringify(saved),
);
} else {
window.sessionStorage.removeItem(getJdReviewSavedStorageKey(id));
}

router.push(`/mockApply/actual/${id}/jd-review`);
router.push(`/mockApply/${id}/jd-review`);
};

const processJobPosting = async ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function MockApplicationJdInputPage() {
onMethodChange={setSelectedMethod}
/>
<Footer
backAction={{ onClick: () => router.push("/mockApply") }}
backAction={{ onClick: () => router.push("/") }}
ctaAction={{
label: "선택하기",
disabled: selectedMethod === null,
Expand Down
28 changes: 22 additions & 6 deletions jobdri/src/app/mockApply/[mockApplyId]/(jd)/jd-review/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function createSavePayload(
metadata?: JdReviewMetadata,
): JobPostingSavePayload {
const companyName = getSectionValue(sections, "company");
const jobTitle = getSectionValue(sections, "job");
const detailClassificationId = metadata?.detailClassificationId;

if (!companyName) {
Expand All @@ -86,9 +87,16 @@ function createSavePayload(
);
}

if (!jobTitle) {
throw new Error("직무명을 입력해주세요.");
}

return {
profileColor: metadata?.profileColor ?? "DEFAULT",
postingName: metadata?.postingName?.trim() || jobTitle,
companyName,
companySize: metadata?.companySize?.trim() || "STARTUP",
jobTitle,
detailClassificationId,
task: getSectionValue(sections, "main-task"),
requirement: getSectionValue(sections, "qualification"),
Expand Down Expand Up @@ -164,6 +172,9 @@ function saveJdReviewSessionData({
JSON.stringify({
companySize: savedJobPosting.companySize,
detailClassificationId: savedJobPosting.detailClassificationId,
profileColor: savedJobPosting.profileColor,
postingName: savedJobPosting.postingName,
jobTitle: savedJobPosting.jobTitle,
}),
);
}
Expand Down Expand Up @@ -200,7 +211,7 @@ export default function MockApplicationJdReviewPage() {

const openBackConfirm = () => setShowBackConfirm(true);
const closeBackConfirm = () => setShowBackConfirm(false);
const goToJdInput = () => router.replace(`/mockApply/actual/${id}/jd-input`);
const goToJdInput = () => router.replace(`/mockApply/${id}/jd-input`);
const closeSaveError = () => setSaveErrorMessage("");

const handleConfirm = async () => {
Expand Down Expand Up @@ -250,7 +261,7 @@ export default function MockApplicationJdReviewPage() {
setIsSaving(true);

try {
const createNextApplyId = async () => {
const createNextApply = async () => {
const savedJobPosting = await createSavedJobPosting();
const createdApply = await createApplyFromJobPosting({
jobPostingId: savedJobPosting.jobPostingId,
Expand All @@ -275,16 +286,21 @@ export default function MockApplicationJdReviewPage() {
savedJobPosting,
});

return nextApplyId;
return {
jobPostingId: savedJobPosting.jobPostingId,
mockApplyId: nextApplyId,
};
};

const [nextApplyId] = await Promise.all([
createNextApplyId(),
const [nextApply] = await Promise.all([
createNextApply(),
delay(loadingDurationMs),
]);

shouldKeepLoading = true;
router.push(`/mockApply/actual/${nextApplyId}/questions`);
router.push(
`/mockApply/${nextApply.mockApplyId}?jobPostingId=${nextApply.jobPostingId}`,
);
} catch (error) {
setSaveErrorMessage(
error instanceof Error
Expand Down
2 changes: 1 addition & 1 deletion jobdri/src/app/mockApply/[mockApplyId]/(jd)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function JdPage({ params }: JdPageProps) {
<main className="max-w-[1116px] mx-auto">{/* JD 입력 UI */}</main>
<Footer
ctaLabel="다음"
backAction={{ href: "/mockApply" }}
backAction={{ href: "/" }}
ctaAction={{ href: `/mockApply/${mockApplyId}` }}
/>
</>
Expand Down
Loading