Tpayne101 commited on
Commit
331216f
·
verified ·
1 Parent(s): 53be7bf

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -0
app.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from agents import agents
3
+ from utils import chat_with_agent
4
+ from memory import store_memory, recall_memory
5
+ from database import add_user, save_agent, save_conversation
6
+ from metrics import show_dashboard
7
+ from marketplace import show_marketplace
8
+
9
+ st.set_page_config(page_title="AgentForge", page_icon="🔥", layout="wide")
10
+
11
+ st.sidebar.title("ForgeStudio ⚡")
12
+ page = st.sidebar.radio("Navigation", ["Chat", "Marketplace", "Metrics", "Pricing"])
13
+
14
+ # Simple sign-in
15
+ user_email = st.sidebar.text_input("Your Email")
16
+ if st.sidebar.button("Sign in"):
17
+ add_user(user_email)
18
+ st.session_state.user = user_email
19
+ st.success(f"Welcome, {user_email}!")
20
+
21
+ if "user" not in st.session_state:
22
+ st.warning("Please sign in first.")
23
+ st.stop()
24
+
25
+ if page == "Chat":
26
+ agent_choice = st.selectbox("Choose Your Agent", list(agents.keys()) + ["Create New Agent"])
27
+ if agent_choice == "Create New Agent":
28
+ new_name = st.text_input("Agent Name")
29
+ new_persona = st.text_area("Describe your agent's personality")
30
+ if st.button("Save Agent"):
31
+ save_agent(new_name, new_persona, st.session_state.user)
32
+ st.success("Agent created!")
33
+ agents[new_name] = {"persona": new_persona}
34
+ agent_choice = new_name
35
+
36
+ user_input = st.text_input("You:", "")
37
+ if st.button("Send"):
38
+ memories = recall_memory(agent_choice, user_input)
39
+ context = "\n".join(memories[0]) if memories else ""
40
+ prompt = f"{agents[agent_choice]['persona']}\nContext:\n{context}\nUser: {user_input}"
41
+
42
+ ai_response = chat_with_agent(agents[agent_choice]['persona'], [], prompt)
43
+ store_memory(agent_choice, user_input, ai_response)
44
+ save_conversation(agent_choice, st.session_state.user, user_input, ai_response)
45
+
46
+ st.markdown(f"🤖 **{agent_choice}:** {ai_response}")
47
+
48
+ elif page == "Marketplace":
49
+ show_marketplace()
50
+
51
+ elif page == "Metrics":
52
+ show_dashboard()
53
+
54
+ elif page == "Pricing":
55
+ st.subheader("💎 AgentForge Pro")
56
+ st.write("Upgrade for unlimited agents, memory, and marketplace publishing.")
57
+ st.markdown("[Subscribe via Stripe →](https://buy.stripe.com/test_your_stripe_link)")