Skip to content

Commit

Permalink
revert scroll into view behavior
Browse files Browse the repository at this point in the history
match max_tokens for query generator
  • Loading branch information
devxpy committed Dec 17, 2024
1 parent 7ec2d44 commit 432c62d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
3 changes: 1 addition & 2 deletions daras_ai_v2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from daras_ai_v2.fastapi_tricks import get_route_path
from daras_ai_v2.github_tools import github_url_for_file
from daras_ai_v2.grid_layout_widget import grid_layout
from daras_ai_v2.html_spinner_widget import html_spinner, scroll_into_view
from daras_ai_v2.html_spinner_widget import html_spinner
from daras_ai_v2.manage_api_keys_widget import manage_api_keys
from daras_ai_v2.meta_preview_url import meta_preview_url
from daras_ai_v2.query_params_util import extract_query_params
Expand Down Expand Up @@ -1944,7 +1944,6 @@ def on_submit(self):
sr = self.create_and_validate_new_run(enable_rate_limits=True)
if not sr:
return
scroll_into_view(".gooey-spinner-top")
self.call_runner_task(sr)
return sr

Expand Down
12 changes: 6 additions & 6 deletions daras_ai_v2/html_spinner_widget.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import json

import gooey_gui as gui


def html_spinner(text: str):
def html_spinner(text: str, scroll_into_view=True):
gui.html(
# language=HTML
f"""
Expand All @@ -14,6 +12,8 @@ def html_spinner(text: str):
"""
)


def scroll_into_view(selector: str):
gui.js("document.querySelector(%s).scrollIntoView();" % json.dumps(selector))
if scroll_into_view:
gui.js(
# language=JavaScript
"""document.querySelector(".gooey-spinner-top").scrollIntoView()"""
)
2 changes: 1 addition & 1 deletion daras_ai_v2/query_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def generate_final_search_query(
return run_language_model(
model=request.selected_model,
prompt=instructions,
max_tokens=1024,
max_tokens=request.max_tokens,
quality=request.quality,
temperature=request.sampling_temperature,
avoid_repetition=request.avoid_repetition,
Expand Down
2 changes: 1 addition & 1 deletion daras_ai_v2/variables_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def variables_input(
)
pressed_add = False
if var_names or allow_add:
with gui.div(className="d-flex align-items-center gap-3 mb-2"):
with gui.div(className="d-flex align-items-center gap-3 mb-2"):
gui.write(
label,
help=f"{description} <a href='/variables-help' target='_blank'>Learn more</a>.",
Expand Down
3 changes: 2 additions & 1 deletion recipes/VideoBots.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,8 @@ def search_step(self, request, response, user_input, model):
yield "Finding keywords..."
k_request = request.copy()
# other models dont support JSON mode
k_request.selected_model = LargeLanguageModels.gpt_4_turbo.name
k_request.selected_model = LargeLanguageModels.gpt_4_o.name
k_request.max_tokens = 4096
keyword_query = json.loads(
generate_final_search_query(
request=k_request,
Expand Down
4 changes: 3 additions & 1 deletion server.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,6 @@ async def _exc_handler(request: Request, exc: Exception, template_name: str):
if __name__ == "__main__":
from gooey_gui.core.reloader import runserver

runserver("server:app", port=8080, reload=True, reload_excludes=["models.py"])
runserver(
"server:app", port=8080, reload=True, reload_excludes=["models.py", "api.py"]
)

0 comments on commit 432c62d

Please sign in to comment.