forked from streamlit/streamlit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow inline usage of
st.chat_input
(streamlit#7896)
* Add initial version of inline chat input * Adapt python test * Fix tests * Fix tests * Fix tests * Fix tests * Remove unused import * Remove e2e tests * Fix test id names * Improve playwright conftest * Format conftest * Update tests * Fix unembedded iframe * Update snapshots * Add e2e test script * Add e2e tests * Add updated snapshots * Finalize test * Revert toast change * Fixes and improvements * Add missing snapshots * Update snapshots * Fix observer effect * Fix flickering effects * Fix typo * Fix comments * Fix test * Remove position parameter from API * Update example * Fix unit tests
- Loading branch information
1 parent
de8dae4
commit fd38b18
Showing
78 changed files
with
614 additions
and
427 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+4.63 KB
...t/__snapshots__/linux/st_chat_input_test/st_chat_input-app_bottom[chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.38 KB
...ht/__snapshots__/linux/st_chat_input_test/st_chat_input-app_bottom[firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.26 KB
...ght/__snapshots__/linux/st_chat_input_test/st_chat_input-app_bottom[webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+32.4 KB
..._/linux/st_chat_input_test/st_chat_input-app_embedded_with_bottom[chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+53.1 KB
...__/linux/st_chat_input_test/st_chat_input-app_embedded_with_bottom[firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.7 KB
...s__/linux/st_chat_input_test/st_chat_input-app_embedded_with_bottom[webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.65 KB
...right/__snapshots__/linux/st_chat_input_test/st_chat_input-bottom[chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.48 KB
...wright/__snapshots__/linux/st_chat_input_test/st_chat_input-bottom[firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.44 KB
...ywright/__snapshots__/linux/st_chat_input_test/st_chat_input-bottom[webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.97 KB
...ght/__snapshots__/linux/st_chat_input_test/st_chat_input-callback[chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.71 KB
...ight/__snapshots__/linux/st_chat_input_test/st_chat_input-callback[firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.77 KB
...right/__snapshots__/linux/st_chat_input_test/st_chat_input-callback[webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.73 KB
...shots__/linux/st_chat_input_test/st_chat_input-focused[dark_theme-chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.4 KB
...pshots__/linux/st_chat_input_test/st_chat_input-focused[dark_theme-firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.43 KB
...apshots__/linux/st_chat_input_test/st_chat_input-focused[dark_theme-webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.91 KB
...hots__/linux/st_chat_input_test/st_chat_input-focused[light_theme-chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.71 KB
...shots__/linux/st_chat_input_test/st_chat_input-focused[light_theme-firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.68 KB
...pshots__/linux/st_chat_input_test/st_chat_input-focused[light_theme-webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.1 KB
...wright/__snapshots__/linux/st_chat_input_test/st_chat_input-grows[chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.4 KB
...ywright/__snapshots__/linux/st_chat_input_test/st_chat_input-grows[firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.5 KB
...aywright/__snapshots__/linux/st_chat_input_test/st_chat_input-grows[webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.35 KB
...shots__/linux/st_chat_input_test/st_chat_input-in_column_disabled[chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.65 KB
...pshots__/linux/st_chat_input_test/st_chat_input-in_column_disabled[firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.09 KB
...apshots__/linux/st_chat_input_test/st_chat_input-in_column_disabled[webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.59 KB
...right/__snapshots__/linux/st_chat_input_test/st_chat_input-inline[chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.29 KB
...wright/__snapshots__/linux/st_chat_input_test/st_chat_input-inline[firefox].png
Oops, something went wrong.
Binary file added
BIN
+2.4 KB
...ywright/__snapshots__/linux/st_chat_input_test/st_chat_input-inline[webkit].png
Oops, something went wrong.
Binary file added
BIN
+10 KB
...ots__/linux/st_chat_input_test/st_chat_input-max_chars[dark_theme-chromium].png
Oops, something went wrong.
Binary file added
BIN
+16.9 KB
...hots__/linux/st_chat_input_test/st_chat_input-max_chars[dark_theme-firefox].png
Oops, something went wrong.
Binary file added
BIN
+9.39 KB
...shots__/linux/st_chat_input_test/st_chat_input-max_chars[dark_theme-webkit].png
Oops, something went wrong.
Binary file added
BIN
+10.1 KB
...ts__/linux/st_chat_input_test/st_chat_input-max_chars[light_theme-chromium].png
Oops, something went wrong.
Binary file added
BIN
+17.4 KB
...ots__/linux/st_chat_input_test/st_chat_input-max_chars[light_theme-firefox].png
Oops, something went wrong.
Binary file added
BIN
+9.46 KB
...hots__/linux/st_chat_input_test/st_chat_input-max_chars[light_theme-webkit].png
Oops, something went wrong.
Binary file added
BIN
+2.76 KB
...ots__/linux/st_chat_input_test/st_chat_input-shift_enter_new_line[chromium].png
Oops, something went wrong.
Binary file added
BIN
+3.69 KB
...hots__/linux/st_chat_input_test/st_chat_input-shift_enter_new_line[firefox].png
Oops, something went wrong.
Binary file added
BIN
+2.62 KB
...shots__/linux/st_chat_input_test/st_chat_input-shift_enter_new_line[webkit].png
Oops, something went wrong.
Binary file added
BIN
+8.8 KB
...ight/__snapshots__/linux/st_chat_input_test/st_chat_input-shrinks[chromium].png
Oops, something went wrong.
Binary file added
BIN
+15.4 KB
...right/__snapshots__/linux/st_chat_input_test/st_chat_input-shrinks[firefox].png
Oops, something went wrong.
Binary file added
BIN
+8.26 KB
...wright/__snapshots__/linux/st_chat_input_test/st_chat_input-shrinks[webkit].png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import streamlit as st | ||
from streamlit import runtime | ||
|
||
v1 = st.container().chat_input("Chat input 1 (inline)") | ||
st.write("Chat input 1 (inline) - value:", v1) | ||
|
||
col1, _ = st.columns(2) | ||
|
||
v2 = col1.chat_input("Chat input 2 (in column, disabled)", disabled=True) | ||
st.write("Chat input 2 (in column, disabled) - value:", v2) | ||
|
||
if runtime.exists(): | ||
|
||
def on_submit(): | ||
st.text("chat input submitted") | ||
|
||
st.container().chat_input( | ||
"Chat input 3 (callback)", key="chat_input_3", on_submit=on_submit | ||
) | ||
st.write("Chat input 3 (callback) - value:", st.session_state.get("chat_input_3")) | ||
|
||
v4 = st.chat_input("Chat input 4 (bottom, max_chars)", max_chars=200) | ||
st.write("Chat input 4 (bottom, max_chars) - value:", v4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.