T-K-O-H commited on
Commit
275af38
·
1 Parent(s): 878dd56

Update sessions and stuff

Browse files
Files changed (5) hide show
  1. .chainlit/config.toml +8 -5
  2. app.py +6 -2
  3. chainlit.en-US.md +53 -0
  4. chainlit.md +19 -17
  5. push_changes.bat +1 -1
.chainlit/config.toml CHANGED
@@ -66,7 +66,7 @@ edit_message = true
66
 
67
  [UI]
68
  # Name of the assistant.
69
- name = "Stock Price Calculator"
70
 
71
  # default_theme = "dark"
72
 
@@ -116,11 +116,14 @@ cot = "full"
116
  # icon_url = "https://avatars.githubusercontent.com/u/128686189?s=200&v=4"
117
  # url = "https://github.com/Chainlit/chainlit/issues"
118
 
 
 
 
 
 
 
119
  [meta]
120
  generated_by = "2.5.5"
121
-
122
- author = "Your Name"
123
  email = "your.email@example.com"
124
  website = "https://huggingface.co/spaces/Shipmaster1/AI_Stock_Agent"
125
-
126
- show_readme_as_default = true
 
66
 
67
  [UI]
68
  # Name of the assistant.
69
+ name = "AI Stock Assistant"
70
 
71
  # default_theme = "dark"
72
 
 
116
  # icon_url = "https://avatars.githubusercontent.com/u/128686189?s=200&v=4"
117
  # url = "https://github.com/Chainlit/chainlit/issues"
118
 
119
+ # Show README as default
120
+ show_readme_as_default = true
121
+
122
+ # Markdown file path
123
+ markdown_path = "chainlit.md"
124
+
125
  [meta]
126
  generated_by = "2.5.5"
127
+ author = "Shipmaster1"
 
128
  email = "your.email@example.com"
129
  website = "https://huggingface.co/spaces/Shipmaster1/AI_Stock_Agent"
 
 
app.py CHANGED
@@ -91,17 +91,21 @@ async def handle_message(message: cl.Message):
91
  if isinstance(response, dict) and "output" in response:
92
  # Add response to history
93
  history.append({"role": "assistant", "content": response["output"]})
 
94
  await cl.Message(content=response["output"]).send()
 
95
  else:
96
  print(f"[Debug] Invalid response format: {response}")
97
- await cl.Message(content="Received an invalid response format from the agent.").send()
 
98
 
99
  # Update history in storage
100
  chat_histories[session_id] = history
101
 
102
  except Exception as e:
103
  print(f"[Debug] Error occurred: {e}")
104
- await cl.Message(content="Sorry, something went wrong while processing your request.").send()
 
105
 
106
  @cl.on_chat_end
107
  async def end_chat():
 
91
  if isinstance(response, dict) and "output" in response:
92
  # Add response to history
93
  history.append({"role": "assistant", "content": response["output"]})
94
+ print(f"[Debug] Sending response to user: {response['output']}")
95
  await cl.Message(content=response["output"]).send()
96
+ print("[Debug] Response sent successfully")
97
  else:
98
  print(f"[Debug] Invalid response format: {response}")
99
+ error_msg = "Received an invalid response format from the agent."
100
+ await cl.Message(content=error_msg).send()
101
 
102
  # Update history in storage
103
  chat_histories[session_id] = history
104
 
105
  except Exception as e:
106
  print(f"[Debug] Error occurred: {e}")
107
+ error_msg = "Sorry, something went wrong while processing your request."
108
+ await cl.Message(content=error_msg).send()
109
 
110
  @cl.on_chat_end
111
  async def end_chat():
chainlit.en-US.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AI Stock Assistant 📈
2
+
3
+ Welcome to your intelligent stock market companion! I can help you with real-time stock information and calculations.
4
+
5
+ ## Features
6
+
7
+ ### 1️⃣ Real-Time Stock Prices
8
+ Get instant price updates for any stock:
9
+ ```
10
+ AAPL
11
+ MSFT
12
+ GOOGL
13
+ ```
14
+
15
+ ### 2️⃣ Share Calculations
16
+ Calculate how many shares you can buy:
17
+ ```
18
+ How many AAPL shares can I buy with $10000?
19
+ What can I get of Tesla for $5000?
20
+ ```
21
+
22
+ ### 3️⃣ Smart Features
23
+ - Understands both ticker symbols and company names
24
+ - Remembers context from previous messages
25
+ - Supports all major stock exchanges
26
+
27
+ ## Popular Stocks to Try
28
+
29
+ ### Tech Companies
30
+ - `AAPL` - Apple
31
+ - `MSFT` - Microsoft
32
+ - `GOOGL` - Google
33
+ - `AMZN` - Amazon
34
+ - `META` - Meta/Facebook
35
+ - `TSLA` - Tesla
36
+ - `NVDA` - NVIDIA
37
+
38
+ ### Financial
39
+ - `JPM` - JPMorgan
40
+ - `BAC` - Bank of America
41
+ - `GS` - Goldman Sachs
42
+
43
+ ### Retail
44
+ - `WMT` - Walmart
45
+ - `COST` - Costco
46
+ - `SBUX` - Starbucks
47
+
48
+ ## Tips
49
+ - Use either ticker symbols (e.g., `AAPL`) or company names
50
+ - Include dollar amounts to calculate shares
51
+ - All prices are real-time from the market
52
+
53
+ Try it now! Type a ticker symbol or ask about any company listed above.
chainlit.md CHANGED
@@ -1,28 +1,30 @@
1
- # Stock Price & Share Calculator 📈
2
 
3
- Welcome! This app helps you:
4
- 1. Check real-time stock prices
5
- 2. Calculate how many shares you can buy with a specific amount
6
 
7
- ## Quick Start Guide 🚀
8
 
9
- ### 1️⃣ Get Stock Prices
10
- Just type a ticker symbol or company name:
11
  ```
12
  AAPL
13
- ```
14
- or
15
- ```
16
- What's the price of Apple?
17
  ```
18
 
19
- ### 2️⃣ Calculate Shares
20
- Ask how many shares you can afford:
21
  ```
22
  How many AAPL shares can I buy with $10000?
 
23
  ```
24
 
25
- ## Popular Stocks You Can Try 💎
 
 
 
 
 
26
 
27
  ### Tech Companies
28
  - `AAPL` - Apple
@@ -43,9 +45,9 @@ How many AAPL shares can I buy with $10000?
43
  - `COST` - Costco
44
  - `SBUX` - Starbucks
45
 
46
- ## Tips 💡
47
- - You can use either the ticker (e.g., `AAPL`) or company name (e.g., "Apple")
48
- - Include a dollar amount to calculate shares (e.g., "AAPL $5000")
49
  - All prices are real-time from the market
50
 
51
  Try it now! Type a ticker symbol or ask about any company listed above.
 
1
+ # AI Stock Assistant 📈
2
 
3
+ Welcome to your intelligent stock market companion! I can help you with real-time stock information and calculations.
 
 
4
 
5
+ ## Features
6
 
7
+ ### 1️⃣ Real-Time Stock Prices
8
+ Get instant price updates for any stock:
9
  ```
10
  AAPL
11
+ MSFT
12
+ GOOGL
 
 
13
  ```
14
 
15
+ ### 2️⃣ Share Calculations
16
+ Calculate how many shares you can buy:
17
  ```
18
  How many AAPL shares can I buy with $10000?
19
+ What can I get of Tesla for $5000?
20
  ```
21
 
22
+ ### 3️⃣ Smart Features
23
+ - Understands both ticker symbols and company names
24
+ - Remembers context from previous messages
25
+ - Supports all major stock exchanges
26
+
27
+ ## Popular Stocks to Try
28
 
29
  ### Tech Companies
30
  - `AAPL` - Apple
 
45
  - `COST` - Costco
46
  - `SBUX` - Starbucks
47
 
48
+ ## Tips
49
+ - Use either ticker symbols (e.g., `AAPL`) or company names
50
+ - Include dollar amounts to calculate shares
51
  - All prices are real-time from the market
52
 
53
  Try it now! Type a ticker symbol or ask about any company listed above.
push_changes.bat CHANGED
@@ -1,4 +1,4 @@
1
  @echo off
2
  git add .
3
- git commit -m "Add Chainlit configuration and documentation"
4
  git push origin main
 
1
  @echo off
2
  git add .
3
+ git commit -m "Add detailed debug logging for message handling"
4
  git push origin main