Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,8 +44,8 @@ def get_ai_response(prompt, chat_history):
|
|
| 44 |
user_tokens = num_tokens_from_string(prompt)
|
| 45 |
|
| 46 |
# Maximum allowed tokens
|
| 47 |
-
|
| 48 |
-
available_tokens =
|
| 49 |
|
| 50 |
# Trim chat history if necessary
|
| 51 |
trimmed_history = []
|
|
@@ -234,7 +234,9 @@ with st.sidebar:
|
|
| 234 |
system_prompt = st.text_area("System Prompt", height=200)
|
| 235 |
temperature = st.slider("Temperature", min_value=0.0, max_value=1.0, value=0.3, step=0.1)
|
| 236 |
top_p = st.slider("Top-P", min_value=0.01, max_value=1.00, value=1.00, step=0.01)
|
|
|
|
| 237 |
max_tokens = st.slider("Max Tokens (Output)", min_value=1, max_value=1024, value=1024, step=1)
|
|
|
|
| 238 |
st.header("Restore History")
|
| 239 |
history_input = st.text_area("Paste conversation history:", height=200)
|
| 240 |
if st.button("Restore History"):
|
|
|
|
| 44 |
user_tokens = num_tokens_from_string(prompt)
|
| 45 |
|
| 46 |
# Maximum allowed tokens
|
| 47 |
+
max_context_length = context_length - max_tokens
|
| 48 |
+
available_tokens = max_context_length - system_tokens - user_tokens
|
| 49 |
|
| 50 |
# Trim chat history if necessary
|
| 51 |
trimmed_history = []
|
|
|
|
| 234 |
system_prompt = st.text_area("System Prompt", height=200)
|
| 235 |
temperature = st.slider("Temperature", min_value=0.0, max_value=1.0, value=0.3, step=0.1)
|
| 236 |
top_p = st.slider("Top-P", min_value=0.01, max_value=1.00, value=1.00, step=0.01)
|
| 237 |
+
context_length = st.slider("Context Length", min_value=1, max_value=4096, value=4096, step=1)
|
| 238 |
max_tokens = st.slider("Max Tokens (Output)", min_value=1, max_value=1024, value=1024, step=1)
|
| 239 |
+
|
| 240 |
st.header("Restore History")
|
| 241 |
history_input = st.text_area("Paste conversation history:", height=200)
|
| 242 |
if st.button("Restore History"):
|