Skip to content

Commit 83e052f

Browse files
authored
Merge branch 'main' into create-datatable-app-for-tutorial
2 parents 91097af + b34e4b7 commit 83e052f

File tree

24 files changed

+92
-30
lines changed

24 files changed

+92
-30
lines changed

.github/workflows/app_harness.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: app-harness
22
env:
33
REFLEX_VERSION: "==0.3.2"
4+
TELEMETRY_ENABLED: false
45
on:
56
push:
67
branches: [ main ]

.github/workflows/check_export.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: check-export
22
env:
3-
REFLEX_VERSION: "==0.2.9"
3+
REFLEX_VERSION: "==0.3.2"
4+
TELEMETRY_ENABLED: false
45
on:
56
push:
67
branches: [ main ]
@@ -59,6 +60,7 @@ jobs:
5960
source venv/bin/activate
6061
6162
pip install 'reflex${{ github.event.inputs.reflex_version || env.REFLEX_VERSION }}' -r requirements.txt
63+
export OPENAI_API_KEY="dummy"
6264
reflex init
6365
reflex export
6466
for a in frontend.zip backend.zip; do

basic_crud/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# basic_crud
2+
3+
This is an example app that defines its own API routes for managing its models.
4+
5+
First initialize the database:
6+
7+
```
8+
reflex db init
9+
reflex db migrate
10+
```
11+
12+
Then run the app:
13+
14+
```
15+
reflex init
16+
reflex run
17+
```
18+
19+
In the UI, the list of known products is displayed on the left. On the right/main screen, user
20+
can select HTTP Method, and enter API endpoint in the box immediately to the right of the drop down.
21+
22+
Endpoints are `products` for GET and POST, and `products/[id]` for GET, PUT, and DELETE.
23+
24+
The body of the response goes in the text area below.
25+
26+
In the bottom pane, the results of sending the HTTP request are shown.

chatroom/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
A multi-client chat room.
44

5+
NOTE: this example does NOT work in prod mode with redis!
6+
57
<img src="assets/screenshot.png">
68

79
## `broadcast_event`
@@ -30,4 +32,4 @@ nick list from the `State` instance of each connected client by iterating over
3032
`app.state_manager.states` values.
3133

3234
The same `broadcast_event` mechanism described above is then used to pass the
33-
nick list via the `state.set_nicks` event to all connected clients.
35+
nick list via the `state.set_nicks` event to all connected clients.

chatroom/chatroom/chatroom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ async def broadcast_event(name: str, payload: t.Dict[str, t.Any] = {}) -> None:
9595
for state in app.state_manager.states.values():
9696
async for update in state._process(
9797
event=rx.event.Event(
98-
token=state.get_token(),
98+
token=state.router.session.client_token,
9999
name=name,
100100
router_data=state.router_data,
101101
payload=payload,
@@ -106,7 +106,7 @@ async def broadcast_event(name: str, payload: t.Dict[str, t.Any] = {}) -> None:
106106
app.event_namespace.emit(
107107
str(rx.constants.SocketEvent.EVENT),
108108
update.json(),
109-
to=state.get_sid(),
109+
to=state.router.session.session_id,
110110
),
111111
)
112112
for response in responses:

chatroom/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
reflex>=0.2.9
1+
reflex>=0.3.0

crm/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Usage of the example's UI
2+
23
## Usage - If you are the first time to run this example.
4+
First initialize the database:
5+
6+
```
7+
reflex db init
8+
reflex db migrate
9+
```
10+
311
The following steps show how to use this UI when you run this example.
412
(1) click Log in, get Started button
513
(2) Sign up account

dalle/dalle/dalle.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
"""Welcome to Pynecone! This file outlines the steps to create a basic app."""
2-
import openai
2+
from openai import OpenAI
3+
34
import reflex as rx
45

6+
client = OpenAI()
7+
58

69
class State(rx.State):
710
"""The app state."""
@@ -16,12 +19,13 @@ def get_dalle_result(self, form_data: dict[str, str]):
1619
self.image_processing = True
1720
yield
1821
try:
19-
response = openai.Image.create(prompt=prompt_text, n=1, size="1024x1024")
20-
self.image_url = response["data"][0]["url"]
22+
response = client.images.generate(prompt=prompt_text, n=1, size="1024x1024")
23+
self.image_url = response.data[0].url
2124
self.image_processing = False
2225
self.image_made = True
2326
yield
24-
except:
27+
except Exception as e:
28+
print(e)
2529
self.image_processing = False
2630
yield rx.window_alert("Error with OpenAI Execution.")
2731

dalle/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
reflex>=0.2.9
2-
openai
2+
openai>=1

ecommerce/ecommerce/ecommerce.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ def inventory():
135135
def field_input(var, placeholder):
136136
return rx.hstack(
137137
rx.spacer(),
138-
rx.text(SEARCH_LABELS[var.name]),
138+
rx.text(SEARCH_LABELS[var._var_name]),
139139
rx.form_control(
140140
rx.input(
141-
id=var.name,
141+
id=var._var_name,
142142
placeholder=placeholder,
143-
is_invalid=State.invalid_inputs[var.name],
143+
is_invalid=State.invalid_inputs[var._var_name],
144144
),
145145
width="50%",
146146
is_required=True,

0 commit comments

Comments
 (0)