Spaces:
Sleeping
Sleeping
Commit History
-
There is a persistence issue where I would pass the level, and the database only saves the current level index in the prompts array and delete every response prior. Change the db saving strategy so that the database, while retaining the same schema and data structure, would save every historic response on every index of their answers. handle it robustly, so it is the case regardless of the user login, device status.
Verified signatureTo resolve the persistence issue where previous responses were being overwritten, we need to modify the save_user_progress and check_attempt logic. Instead of replacing the entire prompts array with a version that might only contain the latest entry, we will use MongoDB's $set operator to target specific indices in the array or update the whole list more carefully. The following implementation ensures that every response at every level is preserved throughout the user's session and saved robustly to the database. Why this fixes the issue: State Integrity: By passing the current_prompts (which is a gr.State list) into the function, we ensure the script always has access to the answers from Level 0, Level 1, etc., regardless of which level the user is currently on. Array Management: The current_prompts[current_max] = prompt line updates only the relevant index in your local session while leaving others untouched. Atomic Updates: Using $set with the entire prompts list ensures that M…087dfed -
import error fixed
Verified signaturebc8dc93 -
CSS update with syntax fixed from previous copy error
Verified signature299c501 -
light mode css style
Verified signature15920f9
-
[FT] System Log to the bottom of the Arena tab. It captures real-time data from your hacking attempts—including timestamps, the full system-formatted prompt, the LLM's raw response, and the final breach status.
Verified signatureReal-Time Feed: Every time the user clicks "Attack," the check_attempt function appends a new block of data to the log_history state. Full Data Transparency: It displays the response.prompt, which is the final string sent to the LLM (including your system context), and the response.completion, which is the raw unfiltered output. Persistent History: Because it uses gr.State, the log persists as the user moves from Level 0 to Level 1, creating a continuous "hacking trail". Aesthetic: The #terminal-log CSS ensures the textbox stays black with green text, perfectly matching the hacking theme.cbc199b -
CSS Font Integration
Verified signatured73f195 -
[debug] if not databse -> if database is None
Verified signatured1daaf8 -
[FT] added back leaderboard tab, admin tab, and each level description
Verified signature899a1e7 -
[debug] level progression expected response and result evaluation
Verified signatureBorrowing the Correct Evaluation: I reintegrated the original format_evaluation function to return "Pass ✅" or "Fail ❌" into a dedicated evaluation_status textbox. Dynamic "Expected Completion": When check_attempt finishes, it now calls get_level_expected_completion(new_max). This ensures that the moment you move to Level 1, the box updates from "I have been PWNED" to the next target. Sequential Updates: The test_btn.click now maps the 10th output to evaluation_status, so you get instant visual confirmation of your pass before the level contents refresh for the next challenge.2a9701a -
[FT] Add section Expected Response right next to AI's Response and Progress Bar
Verified signatureTo integrate the Expected Response section alongside the AI's Response, we need to modify the UI layout to include a new gr.Textbox and update the check_attempt and on_load functions to provide that data. UI Layout: I placed res_output and expected_output inside a gr.Row(). This causes them to appear side-by-side in the "Arena" tab. get_expected_completion Function: Created a helper function to pull the correct target string from your evaluator logic. It explicitly masks the secret key for Level 2 so users can't just copy-paste it. State Management: Added expected_output to the outputs list of both test_btn.click and demo.load. This ensures that when a user clears a level or signs in, the target phrase updates to match the current challenge. Visual Indicator: The gr.Slider serves as a permanent visual anchor at the top of the interface. Since it is set to interactive=False, users can see it, but only the system can change its value. Synchronized Updates: The progress bar updates i…ce30f03 -
[FT] removes the manual level selector to enforce a linear progression, adds a dual-view (Code/Text) for the system context, and includes the descriptive narrative for each challenge
Verified signature1. add back get_level_description while retaining system context. 2. write gr.Markdown("# 🛡️ HackAPrompt: The Ultimate Challenge") gr.Markdown("Welcome, Hacker! Your mission is simple: manipulate the AI to output a specific phrase. " "Each level gets harder. Can you reach Level 10?") at the top of the page. 3. get rid of Select Level since user is supposed to just automatically increment to the next level when they beat the last one. 4. system context only has a code displayer. add a text displayer alongside the code displayer, so the user can decide to display the system context as a code or a text. Linear Progression: The Radio level selector is removed. The app now tracks the user's max_unlocked state and automatically serves the challenge for that level. Challenge Context: Users can now toggle between Code View (syntax highlighted) and Text View (standard markdown) to see the system instructions they are attempting to bypass. Persistent Sessions: On page load, the app que…48fbafb -
integrates [FT] Hugging Face OAuth for persistence, MongoDB for data storage, a Level Progression system (0–10), a hidden Admin Dashboard for JerMa88, and a public Leaderboard/Hall of Fame.
Verified signaturee438862 -
[FT] Added Prompt Template section, a leaderboard and an Admin Dashboard
Verified signaturee23982d -
openai.AuthenticationError instead of openai.error.AuthenticationError since openai.error is deprecated
Verified signaturef20a728 -
Rewrote the program as I do not need other 2 completors anyway... Trash OpenAI Migrate function...
Verified signature2b50232 -
Delete one of the 2 api_key args: kwarg repeated api_key
Verified signature4207872 -
Ran openai migrate
Verified signaturecbd87b7 -
Fixed error because of a mismatch between the number of inputs defined in your btn.click function and the arguments expected by the check_attempt function
Verified signatureIn the previous script, btn.click was sending 6 items (due to how Gradio handles the OAuthProfile when it's passed as an input), but the function was only looking for 5. The Fix You need to update the check_attempt function signature to handle the gr.OAuthProfile correctly and adjust the btn.click call. Why did this happen? Gradio has a "magic" behavior: if you define a function that expects a gr.OAuthProfile type hint, Gradio automatically injects the logged-in user's profile as the last argument if it isn't explicitly provided in the inputs list. The mistakes in the previous snippet were: Passing gr.State(None) manually as an input, which created an extra argument. The function signature wasn't aligned with the order Gradio expects. One more important check: Make sure your save_user_progress and get_user_data functions are robust. If a user isn't logged in, profile will be None. Your code should handle this gracefully so the game still works for "guests" (even if their progress…9c3e671 -
HF OAuth for Level Progression and User Persistence
Verified signatureKey Changes Explained Friendly Tone: Removed terms like "Prompt Template" and "Few Shot Defense" from the main labels. I replaced them with "Arena," "Attack Prompt," and "The Wall" to make it feel like a game. Level Progression: I added a max_unlocked state. The check_attempt function checks if the user's current level equals their max_unlocked. If they pass, max_unlocked increments, and the UI automatically switches them to the next tab. Hugging Face OAuth & Persistence: The app now includes a gr.LoginButton. When a user signs in with their Hugging Face account, gr.OAuthProfile provides their username. The load_user_session function runs as soon as the page loads. It checks your MongoDB for that specific username and restores their saved prompts and their highest unlocked level. Simplified Models: The model selection is gone. It is hardcoded to gpt-3.5-turbo. The API key input is gone. The script now looks for OPENAI_API_KEY in your Space's environment variables (Settings > S…a29c1be -
Edit UI for Event
Verified signature6bdbd90 -
Update hackaprompt/gradio_app.py
Verified signature58e6539
-
Update hackaprompt/gradio_app.py
Verified signaturea80713a
-
feat: double concurrency_count
8d9e918
-
Merge pull request #51 from jerpint/add-submission-form
Unverified signatureWIP: add new submission form tabaa328fd -
Update gradio_app.py
Unverified signature34e8aa8 -
fix: infrequent None add error
e7446f0
-
better syntax
bbc448c -
add default model
d7a3242 -
lint
dcd0dc2 -
remove tab; change way UI interacts and saves state
207befa -
Merge branch 'main' into add-submission-form
3c3342b
-
feat: not flan note
f418f1f
-
feat: download note
bac8bf1 -
feat: 10 hasn't been solved note
9c7a546
-
fix off-by-one bug
be15ceb -
make interactive; keep state
490de03 -
update instructions
5e8cc24 -
WIP: add submission form
456a8a4 -
Update backend (#49)
Unverified signatureOnly update user responses when actually evaluating a model This speeds up front end rendering and also fixes the weird UI that changing a model doesn't always persist as expected. Refactored a little too so that frotnend and backend elements stay close together9bc8547 -
feat: submission and emoji notes
4aa81ef
-
fix: make password style
487e2f9 -
fix: dont show second prompt on level 0
1bf0e20
-
Merge branch 'main' of https://github.com/jerpint/hackaprompt into main
merge maine388d13 -
fix: slashes too late
2accd8d
-
feat: cache prompts to speed up frontend
ed614a3 -
fix: remove old attempts
26cc5d4 -
feat: improve message
f67bc08 -
fix: instructions
066a8b3 -
fix: title typo
367651d -
feat: show exact emojis allowed
3a9f81e