Skip to content
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

fixed incorrect rendering in instructions section #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions api/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def index():
prompt = ""
split_length = ""
file_data = []
num_parts = 0

redis_client.incr("visit_counter")
visit_count = int(redis_client.get("visit_counter"))
Expand All @@ -27,11 +28,11 @@ def index():
prompt = request.form["prompt"]
split_length = int(request.form["split_length"])

file_data = split_prompt(prompt, split_length)
file_data, num_parts = split_prompt(prompt, split_length)

hash_value = generate_random_hash(8)

return render_template("index.html", prompt=prompt, split_length=split_length, file_data=file_data, hash=hash_value, visit_count=visit_count)
return render_template("index.html", prompt=prompt, split_length=split_length, num_parts=num_parts, file_data=file_data, hash=hash_value, visit_count=visit_count)

def split_prompt(text, split_length):
if split_length <= 0:
Expand All @@ -56,7 +57,7 @@ def split_prompt(text, split_length):
'content': content
})

return file_data
return file_data, num_parts

def generate_random_hash(length):
return ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(length))
Expand Down
8 changes: 4 additions & 4 deletions api/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ <h3>Instructions</h3>

For sending you that content, I will follow this rule:

[START PART 1/10]
this is the content of the part 1 out of 10 in total
[END PART 1/10]
[START PART 1/{{ num_parts }}]
this is the content of the part 1 out of {{ num_parts }} in total
[END PART 1/{{ num_parts }}]

Then you just answer: "Received part 1/10"
Then you just answer: "Received part 1/{{ num_parts }}"

And when I tell you "ALL PARTS SENT", then you can continue processing the data and answering my requests.</pre>
<button type="button" class="copy-btn" id="copy-instructions-btn" onclick="copyInstructions()">Copy Instructions (first message to send)</button>
Expand Down