-
Notifications
You must be signed in to change notification settings - Fork 3
Drop a grounding read that a newer one replaced #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,6 +153,7 @@ for (const input of levels) { | |
| } | ||
|
|
||
| let grounding = { requirements: [], skills: [], anchors: [] }; | ||
| const groundingReads = { jd: 0, resume: 0 }; | ||
|
|
||
| nodes.groundingJd.addEventListener("change", () => loadGroundingFile("jd")); | ||
| nodes.groundingResume.addEventListener("change", () => loadGroundingFile("resume")); | ||
|
|
@@ -259,17 +260,19 @@ start.addEventListener("click", async () => { | |
| async function loadGroundingFile(kind) { | ||
| const input = kind === "jd" ? nodes.groundingJd : nodes.groundingResume; | ||
| const status = kind === "jd" ? nodes.groundingJdStatus : nodes.groundingResumeStatus; | ||
| const read = ++groundingReads[kind]; | ||
| status.textContent = "Reading locally..."; | ||
| let parsed = null; | ||
| let message = "Parsed locally. Select only snippets you want to send."; | ||
| try { | ||
| const parsed = await parseGroundingFile(input.files[0], kind); | ||
| if (kind === "jd") grounding.requirements = parsed.requirements; | ||
| else ({ skills: grounding.skills, anchors: grounding.anchors } = parsed); | ||
| status.textContent = "Parsed locally. Select only snippets you want to send."; | ||
| parsed = await parseGroundingFile(input.files[0], kind); | ||
| } catch (error) { | ||
| if (kind === "jd") grounding.requirements = []; | ||
| else { grounding.skills = []; grounding.anchors = []; } | ||
| status.textContent = error.message; | ||
| message = error.message; | ||
| } | ||
| if (read !== groundingReads[kind]) return; | ||
| if (kind === "jd") grounding.requirements = parsed?.requirements ?? []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This guards |
||
| else { grounding.skills = parsed?.skills ?? []; grounding.anchors = parsed?.anchors ?? []; } | ||
| status.textContent = message; | ||
| renderGroundingChoices(retainedSelection(checkedGrounding(), kind)); | ||
| } | ||
|
|
||
|
|
@@ -302,6 +305,8 @@ function renderGroundingChoices(selected) { | |
| } | ||
|
|
||
| function clearGrounding() { | ||
| groundingReads.jd++; | ||
| groundingReads.resume++; | ||
| grounding = { requirements: [], skills: [], anchors: [] }; | ||
| nodes.groundingJd.value = ""; | ||
| nodes.groundingResume.value = ""; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.