Du Mingzhe commited on
Commit
cb6604d
1 Parent(s): f5371e8

Personality

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -2,7 +2,7 @@ from pinecone import Pinecone
2
  from openai import OpenAI
3
  import streamlit as st
4
 
5
- st.title("Talk with Mingzhe:)")
6
 
7
  llm_client = OpenAI(api_key=st.secrets["OPENAI_API_KEY"])
8
  pinecone_client = Pinecone(api_key=st.secrets["PINECONE_API_KEY"])
@@ -11,6 +11,7 @@ def response_generate(prompt, messages):
11
  stream = llm_client.chat.completions.create(
12
  model="gpt-3.5-turbo",
13
  messages=[
 
14
  {"role": m["role"], "content": m["content"]} for m in messages
15
  ],
16
  stream=True,
@@ -24,7 +25,7 @@ for message in st.session_state.messages:
24
  with st.chat_message(message["role"]):
25
  st.markdown(message["content"])
26
 
27
- if prompt := st.chat_input("What is up?"):
28
  st.session_state.messages.append({"role": "user", "content": prompt})
29
  with st.chat_message("user"):
30
  st.markdown(prompt)
 
2
  from openai import OpenAI
3
  import streamlit as st
4
 
5
+ st.title("Talk with Mingzhe 🔮")
6
 
7
  llm_client = OpenAI(api_key=st.secrets["OPENAI_API_KEY"])
8
  pinecone_client = Pinecone(api_key=st.secrets["PINECONE_API_KEY"])
 
11
  stream = llm_client.chat.completions.create(
12
  model="gpt-3.5-turbo",
13
  messages=[
14
+ {'role': 'system', 'content': 'You are Du Mingzhe.'},
15
  {"role": m["role"], "content": m["content"]} for m in messages
16
  ],
17
  stream=True,
 
25
  with st.chat_message(message["role"]):
26
  st.markdown(message["content"])
27
 
28
+ if prompt := st.chat_input("What's up?"):
29
  st.session_state.messages.append({"role": "user", "content": prompt})
30
  with st.chat_message("user"):
31
  st.markdown(prompt)