cdupland
commited on
Commit
·
b3e5484
1
Parent(s):
bc7194f
chore: Update prompt.py to add copy functionality and import pyperclip
Browse files- prompt.py +8 -2
- requirements.txt +1 -0
prompt.py
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
import pandas as pd
|
3 |
from data_manager_bziiit import get_prompts
|
4 |
from langchain_core.messages import AIMessage, HumanMessage
|
5 |
from session import get_rag
|
|
|
6 |
|
7 |
prompts = []
|
8 |
def get_prompts_list():
|
@@ -39,17 +41,21 @@ def get_prompts_list():
|
|
39 |
|
40 |
with st.expander(name):
|
41 |
for i, row in group.iterrows():
|
42 |
-
col1, col3, col4 = st.columns((0.4,
|
43 |
col1.write(num) # index
|
44 |
# col2.write(row['name']) # name
|
45 |
col3.write(row['text']) # text
|
46 |
num += 1
|
47 |
|
48 |
button_phold = col4.empty() # create a placeholder
|
49 |
-
but1, but2 = button_phold.columns(
|
50 |
|
|
|
51 |
do_action = but1.button('Voir plus', key=f"v{i}")
|
52 |
execute = but2.button('Executer', key=f"e{i}")
|
|
|
|
|
|
|
53 |
if execute:
|
54 |
st.session_state.chat_history.append(HumanMessage(content=prompts[i]['text']))
|
55 |
return 1
|
|
|
1 |
import streamlit as st
|
2 |
+
from st_copy_to_clipboard import st_copy_to_clipboard
|
3 |
import pandas as pd
|
4 |
from data_manager_bziiit import get_prompts
|
5 |
from langchain_core.messages import AIMessage, HumanMessage
|
6 |
from session import get_rag
|
7 |
+
import pyperclip
|
8 |
|
9 |
prompts = []
|
10 |
def get_prompts_list():
|
|
|
41 |
|
42 |
with st.expander(name):
|
43 |
for i, row in group.iterrows():
|
44 |
+
col1, col3, col4 = st.columns((0.4, 3, 3))
|
45 |
col1.write(num) # index
|
46 |
# col2.write(row['name']) # name
|
47 |
col3.write(row['text']) # text
|
48 |
num += 1
|
49 |
|
50 |
button_phold = col4.empty() # create a placeholder
|
51 |
+
copy_btn, but1, but2 = button_phold.columns(3)
|
52 |
|
53 |
+
copy = copy_btn.button('Copier', key=f"f{i}")
|
54 |
do_action = but1.button('Voir plus', key=f"v{i}")
|
55 |
execute = but2.button('Executer', key=f"e{i}")
|
56 |
+
|
57 |
+
if copy:
|
58 |
+
pyperclip.copy(prompts[i]['text'])
|
59 |
if execute:
|
60 |
st.session_state.chat_history.append(HumanMessage(content=prompts[i]['text']))
|
61 |
return 1
|
requirements.txt
CHANGED
@@ -38,3 +38,4 @@ langchain-core
|
|
38 |
langchain-mistralai
|
39 |
firecrawl-py
|
40 |
st_copy_to_clipboard
|
|
|
|
38 |
langchain-mistralai
|
39 |
firecrawl-py
|
40 |
st_copy_to_clipboard
|
41 |
+
pyperclip
|