Skip to content

Commit

Permalink
Update memorybot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-usa authored Jul 7, 2023
1 parent 45e2359 commit 4635b0b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion memorybot.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def count_words(string):
st.session_state["paid"] = False
if "cost" not in st.session_state:
st.session_state["cost"] = 0.0
if "balance" not in st.session_state:
st.session_state["balance"] = 0.0
if "deposit" not in st.session_state:
st.session_state["deposit"] = 3.0

def clear_text():
st.session_state["temp"] = st.session_state["input"]
Expand Down Expand Up @@ -181,11 +185,13 @@ def new_chat():
st.session_state.past.append(user_input)
st.session_state.generated.append(output)
st.session_state["cost"] += cb.total_cost
st.session_state["balance"] -= cb.total_cost
# st.session_state["word_count"] = st.session_state["word_count"] * 2 + count_words(user_input) + count_words(output)
else:
st.session_state.past.append(user_input)
if is_four_digit_number(user_input) :
st.session_state["paid"] = True
st.session_state["balance"] += st.session_state["deposit"]
st.session_state.generated.append("谢谢支付,你可以继续使用了")
else:
st.session_state.generated.append("请用下面的支付码支付¥20后才可以再继续使用。支付时请记下转账单号的最后4位数字,在对话框输入这四位数字")
Expand Down Expand Up @@ -226,7 +232,7 @@ def new_chat():

# Display the image with text on top
st.write("I have to pay OpenAI API for each of your usage. Please consider donating $5 to keep this service alive! Thank you!")
st.write("我已经为你的这次使用支付了:", round (st.session_state["cost"]*7*5, 2), "人民币")
st.write("我已经为你的这次使用支付了:", round (st.session_state["cost"]*7*4, 2), "人民币")
st.write("我是史丹福机器人庞博士,我提供此应用的初衷是让国内的人也可以体验使用增加了记忆的ChatGPT。我在为你的每次使用支付调用OpenAI API的费用,请扫码微信或支付宝支付¥20人民币可以使用一天。")
st.write("长期用户可交¥1688年费(和OpenAI付费用户收费一致),填上你的邮箱,我会发给你专属的小程序,记忆力是这个的10倍。")
st.write("我在我的《史丹福机器人庞博士》微信视频号也有很多关于ChatGPT和怎样使用ChatGPT魔法的视频,还有怎么使用这个小程序的视频,欢迎白嫖。也有系统的收费课程《零基础精通掌握ChatGPT魔法》给愿意知识付费的同学深入学习。 ")
Expand Down

0 comments on commit 4635b0b

Please sign in to comment.