MCPcopy
hub / github.com/docker/genai-stack / display_chat

Function display_chat

bot.py:104–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102
103
104def display_chat():
105 # Session state
106 if "generated" not in st.session_state:
107 st.session_state[f"generated"] = []
108
109 if "user_input" not in st.session_state:
110 st.session_state[f"user_input"] = []
111
112 if "rag_mode" not in st.session_state:
113 st.session_state[f"rag_mode"] = []
114
115 if st.session_state[f"generated"]:
116 size = len(st.session_state[f"generated"])
117 # Display only the last three exchanges
118 for i in range(max(size - 3, 0), size):
119 with st.chat_message("user"):
120 st.write(st.session_state[f"user_input"][i])
121
122 with st.chat_message("assistant"):
123 st.caption(f"RAG: {st.session_state[f'rag_mode'][i]}")
124 st.write(st.session_state[f"generated"][i])
125
126 with st.expander("Not finding what you're looking for?"):
127 st.write(
128 "Automatically generate a draft for an internal ticket to our support team."
129 )
130 st.button(
131 "Generate ticket",
132 type="primary",
133 key="show_ticket",
134 on_click=open_sidebar,
135 )
136 with st.container():
137 st.write(" ")
138
139
140def mode_select() -> str:

Callers 1

bot.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected