GooeyAI / gooey-server

The core orchestration logic behind Gooey.AI
https://gooey.ai
Other
9 stars 2 forks source link

fix: ux behavior on save for anonymous users #453

Closed nikochiko closed 2 weeks ago

nikochiko commented 1 month ago

should redirect to login page with next=...

Q/A checklist


Executed in 1.15 secs fish external usr time 2.22 secs 86.00 micros 2.22 secs sys time 0.72 secs 613.00 micros 0.72 secs

To reduce import times, import libraries that take a long time inside the functions that use them instead of at the top of the file:
```python
def my_function():
    import pandas as pd
    ...

Legal Boilerplate

Look, I get it. The entity doing business as “Gooey.AI” and/or “Dara.network” was incorporated in the State of Delaware in 2020 as Dara Network Inc. and is gonna need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Dara Network Inc can use, modify, copy, and redistribute my contributions, under its choice of terms.


devxpy commented 1 month ago

curious if this is upto date as per

@SeanBlagsvedt This is the intended UX flow for anonymous users. https://docs.google.com/presentation/d/1P5MKF0jykYPw-G_9SgvKEpu7fjD2v-0gZgLJB4Uw174/edit#slide=id.g2ef5e525406_0_329

nikochiko commented 1 month ago

curious if this is upto date as per

@SeanBlagsvedt This is the intended UX flow for anonymous users. https://docs.google.com/presentation/d/1P5MKF0jykYPw-G_9SgvKEpu7fjD2v-0gZgLJB4Uw174/edit#slide=id.g2ef5e525406_0_329

needs an update, if I remember right

nikochiko commented 1 month ago

is this finally on me? I saw 3 commits being pushed after it was assigned to me

yes, later two were fixes from the review

devxpy commented 1 month ago

is this finally on me? I saw 3 commits being pushed after it was assigned to me

yes, later two were fixes from the review

sorry i didn't realise the review got out

devxpy commented 1 month ago

@SeanBlagsvedt shouldnt the update button be the bigger one?

image

the save button also feels like it should be square and not squeezed tall

same square problem with this fork button

image
devxpy commented 1 month ago

odd behavior

devxpy commented 1 month ago
image

close button should be top right corner aligned like so

image
devxpy commented 1 month ago

dialog buttons should be aligned at the corners with equal spacing on bottom and left/right

image image

example of proper alignment:

image
devxpy commented 1 month ago

inconsistency of display between update and options buttons:

i think the right thing here is to show options and update on only the run tab and show just copy link on others

nikochiko commented 1 month ago

odd behavior

  • click on share
  • change visibility
  • press copy link
  • close dialog
  • open dialog again, see that visibility hasn't saved

That sounds like a plausible user flow. I'll make it such that the Copy Link button also saves like the other Save button.

nikochiko commented 1 month ago
image

we have bad defaults for padding/margin of headings, this looks uneven too (without any changes made). i'll fix it by adding some top margin/padding to the heading's container too

nikochiko commented 1 month ago

better?

image image
nikochiko commented 1 month ago

That sounds like a plausible user flow. I'll make it such that the Copy Link button also saves like the other Save button

this would require more work than I had thought. right now it doesn't trigger a form submit - all javascript.

nikochiko commented 1 month ago

fixed the rest, other than the Copy Link fix.

i'll need to release gooey-gui and update version for that.

devxpy commented 1 month ago

That sounds like a plausible user flow. I'll make it such that the Copy Link button also saves like the other Save button

this would require more work than I had thought. right now it doesn't trigger a form submit - all javascript.

You can execute js on a python button I believe

if button_pressed:
   gui.js(<js code here>)
nikochiko commented 1 month ago

done

devxpy commented 2 weeks ago

I get this error when I try to press the options button as a fresh anonymous user

Traceback (most recent call last):
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 404, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/fastapi/applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/Users/dev/Projects/dara/ddgai/./server.py", line 107, in middleware
    await app(scope, receive, send)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/starlette/middleware/sessions.py", line 86, in __call__
    await self.app(scope, receive, send_wrapper)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/starlette/middleware/authentication.py", line 48, in __call__
    await self.app(scope, receive, send)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/starlette/middleware/cors.py", line 92, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/starlette/middleware/cors.py", line 147, in simple_response
    await self.app(scope, receive, send)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 75, in __call__
    raise exc
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 64, in __call__
    await self.app(scope, receive, sender)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/starlette/routing.py", line 680, in __call__
    await route.handle(scope, receive, send)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/starlette/routing.py", line 275, in handle
    await self.app(scope, receive, send)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/starlette/routing.py", line 65, in app
    response = await func(request)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/fastapi/routing.py", line 231, in app
    raw_response = await run_endpoint_function(
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/fastapi/routing.py", line 162, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/Users/dev/.virtualenvs/ddgai-b0692ca2/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/Users/dev/Projects/dara/gooey-gui/py/gooey_gui/core/renderer.py", line 70, in wrapper
    return renderer(
  File "/Users/dev/Projects/dara/gooey-gui/py/gooey_gui/core/renderer.py", line 117, in renderer
    ret = render()
  File "/Users/dev/Projects/dara/ddgai/routers/root.py", line 615, in recipe_or_handle_or_static
    return render_recipe_page(request, parts[0], RecipeTabs.run, example_id)
  File "/Users/dev/Projects/dara/ddgai/routers/root.py", line 691, in render_recipe_page
    page.render()
  File "/Users/dev/Projects/dara/ddgai/./daras_ai_v2/base.py", line 362, in render
    self._render_header()
  File "/Users/dev/Projects/dara/ddgai/./daras_ai_v2/base.py", line 408, in _render_header
    self._render_options_button_with_dialog()
  File "/Users/dev/Projects/dara/ddgai/./daras_ai_v2/base.py", line 473, in _render_options_button_with_dialog
    self._unsaved_options_modal()
  File "/Users/dev/Projects/dara/ddgai/./daras_ai_v2/base.py", line 844, in _unsaved_options_modal
    assert self.request.user
AssertionError
nikochiko commented 2 weeks ago

@devxpy fixed both in https://github.com/GooeyAI/gooey-server/pull/481

devxpy commented 2 weeks ago

I can still repro this in prod:

nikochiko commented 2 weeks ago

fixed in https://github.com/GooeyAI/gooey-server/pull/482 with self.current_sr.refresh_from_db() before queueing.

cause was that we updated current_sr.uid in the database with SavedRun.objects.update(), but not in the ORM object. we should probably get rid of uid from the runner task too. SavedRun.id should be good enough

devxpy commented 2 weeks ago

this also broke rate limits fixed in https://github.com/GooeyAI/gooey-server/commit/7fe01cb4965cfe2dc5da33c7c015a13be6945231