-
Notifications
You must be signed in to change notification settings - Fork 2
Autofill #31
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?
Autofill #31
Conversation
|
@Tripplenut This workflow looks less than ideal. There's no way we're going to be doing multiple merges into feature branches and then merging the merges back into main? Our commit history will look awful. I will fix these branches when I have time but students should be doing a rebase instead this is 7 commits for slight changes to 1 file... interactive rebasing will be necessary |
|
@LeadFreeCandy The thing is I rebased. Unless I'm just stupid and don't know how git rebase works but my process for each rebase is just: git checkout feature-branch
git rebase main
git pull
git pushI think the history gets fucked cause I always forget to pull before the rebase and i'm just too lazy to fix it. Also if you wish to teach each person proper git techniques go for it. I don't really mind them just knowing how to commit, merge, and make a pr. I don't think the git workshop will be going over anything other than those 3 as we discussed it during the mentor meeting. If you want to teach them rebase, squash, and cherry pick make sure you do it well and we will also need to change some repo permissions. |
Created a function to find the closest label to the passed input field. Then used a loop to iterate through all the input fields and fill them with their closest label. Still very buggy and in testing phase.
LeadFreeCandy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some great ideas! Not ready to merge but I'm really liking where this is heading!
autofill/autofillScript.ts
Outdated
| function labelDist(labels: Element[], input: Element): Element { | ||
| let minDist = Number.MAX_VALUE; | ||
| let minLabel = labels[0]; | ||
| for (let i = 0; i < labels.length; i++) { | ||
| let dist = Math.abs(labels[i].getBoundingClientRect().top - input.getBoundingClientRect().top); | ||
| if (dist < minDist) { | ||
| minDist = dist; | ||
| minLabel = labels[i]; | ||
| } | ||
| } | ||
| return minLabel; | ||
| } | ||
|
|
||
|
|
||
| // This file will be run on the content page, and should include all the logic for inserting text into form items. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really interesting way to do this. Getting the actual rendered position is really cool! I think this would be a good fallback approach.
I think the first thing we should do is simply grab the label with something like this:
const label = document.querySelector(label[for="${inputField.id}"]);
if the website has its accessibly set up correctly, or use any decent form builder these should already be set up and will probably be more robust
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think i commented out a loop that did this with email fields. Just commented it out so it wouldnt interfere witht the testing
autofill/autofillScript.ts
Outdated
| */ | ||
|
|
||
| // Trigger agree to terms and conditions. Tested on "https://store.steampowered.com/join" but should work on any site with a checkbox with the word "agree" in the name. Proof of concept for checkboxes | ||
| const agreeToTerms = document.querySelector('input[name*="agree"]'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha a robot agreeing to terms and conditions... we definitely might want to discuss whether we can really ethically do this. Maybe worth looking into a way to take the user to the fields that they must fill out manually for ethical reasons? Js has a really easy scrollTo method and we could highlight the field. Not necessary in this PR just something to think about
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can also autocheck captchas too lol, but I thought that was a tad too far
New scripts to find fields and uses LLM to fill them
… of input parameters, then uses GPT-3.5 to fill in fields.
and memory wise. Also added a new feature to autofill allowing for AI completion of dropdown menus. The algoritm continues to use GPT to generate the proper field response. The new drop down algorithm passes GPT all possible options allowing it to choose the appropriate response.
AI responses are stripped of "AI :" prefixes. Dropdowns consitantly filled. AI responses made even more accurate by providing multiple data points to the AI. These include the field label, name and ID
Pull Request
Description
Please include a summary of the changes and the related issue (if applicable). Please also include relevant motivation and context. List any dependencies that are required for this change (if applicable).
Fixes # (issue)
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist
Try to checkoff as much as possible if not everything!