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

remove demo for llama index #1197

Merged
merged 4 commits into from
Jan 29, 2025
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.states
**/*.db
**/*.pyc
**/*.swp
Expand Down
26 changes: 16 additions & 10 deletions pcweb/components/code_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
from reflex.components.datadisplay.shiki_code_block import copy_script


def install_command(command: str, show_dollar_sign: bool = True, **props) -> rx.Component:
def install_command(
command: str, show_dollar_sign: bool = True, **props
) -> rx.Component:
return rx.el.button(
rx.icon("copy", size=14, margin_left="5px"),
rx.text(
Expand Down Expand Up @@ -115,16 +117,22 @@ def gallery_app_card(app: dict) -> rx.Component:
rx.vstack(
rx.box(
rx.hstack(
install_command(f"reflex init --template {app['title']}"),
rx.hstack(
repo(app["demo"]),
justify="start",

install_command(
f"reflex init --template {app['title']}"
),
*(
[
rx.hstack(
repo(app["demo"]),
justify="start",
)
]
if "demo" in app
else []
),
),
width="310px",
max_width="310px",

),
rx.cond(
"Reflex" in app["author"],
Expand All @@ -146,10 +154,8 @@ def gallery_app_card(app: dict) -> rx.Component:
),
),
align_items="start",
class_name="brother-john"
class_name="brother-john",
),


class_name="flex flex-row items-center gap-[6px] justify-between w-full",
),
class_name="flex flex-col justify-between items-start gap-1 p-[0.625rem_0.75rem_0.625rem_0.75rem] w-full h-full",
Expand Down
35 changes: 20 additions & 15 deletions pcweb/pages/gallery/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def get_route(path: str):


def more_posts(current_post: dict) -> rx.Component:

posts = []
app_items = list(gallery_apps_data_copy.items())
current_index = next(
Expand All @@ -49,8 +48,8 @@ def more_posts(current_post: dict) -> rx.Component:
selected_posts = app_items[-3:]
else:
# Create a list of all posts except the current one
other_posts = app_items[:current_index] + app_items[current_index + 1:]
other_posts = app_items[:current_index] + app_items[current_index + 1 :]

if len(other_posts) <= 3:
# If there are 3 or fewer other posts, show all of them
selected_posts = other_posts
Expand All @@ -63,9 +62,9 @@ def more_posts(current_post: dict) -> rx.Component:
else:
# For all other cases, show one before and two after (or two before and one after if we're near the end)
if current_index < len(app_items) - 2:
selected_posts = other_posts[current_index-1:current_index+2]
selected_posts = other_posts[current_index - 1 : current_index + 2]
else:
selected_posts = other_posts[current_index-2:current_index+1]
selected_posts = other_posts[current_index - 2 : current_index + 1]

for path, document in selected_posts:
meta = document.metadata
Expand Down Expand Up @@ -131,14 +130,20 @@ def page(document) -> rx.Component:
class_name="flex flex-col gap-3 p-8",
),
rx.box(
rx.link(
button_with_icon(
"View Demo",
icon="new_tab",
class_name="!w-full flex-row-reverse gap-2",
),
is_external=True,
href=meta["demo"],
*(
[
rx.link(
button_with_icon(
"View Demo",
icon="new_tab",
class_name="!w-full flex-row-reverse gap-2",
),
is_external=True,
href=meta["demo"],
)
]
if meta.get("demo")
else []
),
rx.link(
button("View Code", variant="muted", class_name="!w-full"),
Expand Down Expand Up @@ -192,9 +197,9 @@ def page(document) -> rx.Component:
title=document.metadata["title"],
description=document.metadata["description"],
image=document.metadata["image"],
demo=document.metadata["demo"],
demo=document.metadata["demo"] if "demo" in document.metadata else None,
meta=document.metadata["meta"],
)(lambda doc=document: page(doc))

# Add the route to the list of routes.
gallery_apps_routes.append(comp)
gallery_apps_routes.append(comp)
1 change: 0 additions & 1 deletion templates/llamaindex-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: reflex-llamaindex-template
description: "A minimal chat app using LLamaIndex"
author: "Reflex"
image: "llamaindex.png"
demo: "https://frontend-gold-orca.dev.reflexcorp.run/"
source: "https://github.com/reflex-dev/reflex-llamaindex-template"
meta: [
{"name": "keywords", "content": ""},
Expand Down