Compare commits
3 Commits
f259d6b3e3
...
397e5b3307
| Author | SHA1 | Date | |
|---|---|---|---|
| 397e5b3307 | |||
| e926f9c73a | |||
| 29f36f6442 |
@ -4,33 +4,33 @@
|
||||
1. Reset et base
|
||||
========================================== */
|
||||
.stAppHeader {
|
||||
visibility: hidden;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
body,
|
||||
html {
|
||||
font-family:
|
||||
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
|
||||
sans-serif;
|
||||
font-family:
|
||||
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
|
||||
sans-serif;
|
||||
}
|
||||
|
||||
body,
|
||||
.stApp,
|
||||
.block-container {
|
||||
background-color: var(--bg-color) !important;
|
||||
color: var(--text-color) !important;
|
||||
background-color: var(--bg-color) !important;
|
||||
color: var(--text-color) !important;
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
2. Layout et containers
|
||||
========================================== */
|
||||
.block-container {
|
||||
max-width: 1024px !important;
|
||||
padding: 0 1rem 10rem;
|
||||
max-width: 1024px !important;
|
||||
padding: 0 1rem 10rem;
|
||||
}
|
||||
|
||||
.stVerticalBlock {
|
||||
gap: 0.5rem !important;
|
||||
gap: 0.5rem !important;
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
@ -42,97 +42,97 @@ body,
|
||||
.stDownloadButton > button,
|
||||
.stFormSubmitButton > button,
|
||||
.stSlider > div > div {
|
||||
background-color: darkgreen !important;
|
||||
color: white !important;
|
||||
border: 1px solid grey;
|
||||
background-color: darkgreen !important;
|
||||
color: white !important;
|
||||
border: 1px solid grey;
|
||||
}
|
||||
|
||||
.st-key-FormSubmitter-auth_form-Se-connecter {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
section:not([data-testid="stSidebar"])
|
||||
button[data-testid="stBaseButton-primary"],
|
||||
button[data-testid="stBaseButton-primary"],
|
||||
section:not([data-testid="stSidebar"])
|
||||
button[data-testid="stBaseButton-secondary"] {
|
||||
color: white !important;
|
||||
background: darkgreen !important;
|
||||
button[data-testid="stBaseButton-secondary"] {
|
||||
color: white !important;
|
||||
background: darkgreen !important;
|
||||
}
|
||||
|
||||
section:not([data-testid="stSidebar"])
|
||||
button[data-testid="stBaseButton-primary"]
|
||||
p,
|
||||
button[data-testid="stBaseButton-primary"]
|
||||
p,
|
||||
section:not([data-testid="stSidebar"])
|
||||
button[data-testid="stBaseButton-secondary"]
|
||||
p {
|
||||
color: white !important;
|
||||
button[data-testid="stBaseButton-secondary"]
|
||||
p {
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.bouton-fictif {
|
||||
display: inline-flex;
|
||||
-moz-box-align: center;
|
||||
align-items: center;
|
||||
-moz-box-pack: center;
|
||||
justify-content: center;
|
||||
padding: 0.25rem 0.75rem;
|
||||
border-radius: 0.5rem;
|
||||
min-height: 2.5rem;
|
||||
margin-bottom: 20px;
|
||||
line-height: 1;
|
||||
text-transform: none;
|
||||
font-size: x-large;
|
||||
font-family: inherit;
|
||||
user-select: none;
|
||||
border: 1px solid rgba(49, 51, 63, 0.2);
|
||||
background-color: darkgrey !important;
|
||||
color: darkgreen !important;
|
||||
font-weight: bold !important;
|
||||
width: 100%;
|
||||
letter-spacing: 0.2em;
|
||||
display: inline-flex;
|
||||
-moz-box-align: center;
|
||||
align-items: center;
|
||||
-moz-box-pack: center;
|
||||
justify-content: center;
|
||||
padding: 0.25rem 0.75rem;
|
||||
border-radius: 0.5rem;
|
||||
min-height: 2.5rem;
|
||||
margin-bottom: 20px;
|
||||
line-height: 1;
|
||||
text-transform: none;
|
||||
font-size: x-large;
|
||||
font-family: inherit;
|
||||
user-select: none;
|
||||
border: 1px solid rgba(49, 51, 63, 0.2);
|
||||
background-color: darkgrey !important;
|
||||
color: darkgreen !important;
|
||||
font-weight: bold !important;
|
||||
width: 100%;
|
||||
letter-spacing: 0.2em;
|
||||
}
|
||||
|
||||
button[data-testid="stBaseButton-headerNoPadding"] svg {
|
||||
fill: var(--text-color) !important;
|
||||
fill: var(--text-color) !important;
|
||||
}
|
||||
|
||||
/* --- 3.2 Onglets et radiogroup --- */
|
||||
div[role="radiogroup"] > label {
|
||||
padding: 0.5em 1em;
|
||||
border-radius: 0.4em;
|
||||
margin-right: 0.5em;
|
||||
cursor: pointer;
|
||||
border: 1px solid #fff;
|
||||
padding: 0.5em 1em;
|
||||
border-radius: 0.4em;
|
||||
margin-right: 0.5em;
|
||||
cursor: pointer;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
|
||||
div[role="radiogroup"] > label[data-selected="true"] {
|
||||
font-weight: bold;
|
||||
border: 2px solid #145a1a;
|
||||
font-weight: bold;
|
||||
border: 2px solid #145a1a;
|
||||
}
|
||||
|
||||
section:not([data-testid="stSidebar"]) div[role="radiogroup"] > label p {
|
||||
background-color: var(--radio-bg) !important;
|
||||
color: var(--radio-text) !important;
|
||||
background-color: var(--radio-bg) !important;
|
||||
color: var(--radio-text) !important;
|
||||
}
|
||||
|
||||
section:not([data-testid="stSidebar"])
|
||||
div[role="radiogroup"]
|
||||
> label[data-selected="true"] {
|
||||
background-color: var(--radio-selected-bg) !important;
|
||||
color: var(--radio-selected-text) !important;
|
||||
div[role="radiogroup"]
|
||||
> label[data-selected="true"] {
|
||||
background-color: var(--radio-selected-bg) !important;
|
||||
color: var(--radio-selected-text) !important;
|
||||
}
|
||||
|
||||
/* --- 3.3 Champs de formulaire --- */
|
||||
div[data-baseweb="select"],
|
||||
section:not([data-testid="stSidebar"]) div[data-baseweb="base-input"],
|
||||
section[data-testid="stFileUploaderDropzone"] {
|
||||
border: 1px solid var(--input-border) !important;
|
||||
border-radius: 5px;
|
||||
padding: 4px;
|
||||
border: 1px solid var(--input-border) !important;
|
||||
border-radius: 5px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
small {
|
||||
display: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
section:not([data-testid="stSidebar"]) div[data-testid="stSelectbox"] p,
|
||||
@ -142,7 +142,7 @@ section:not([data-testid="stSidebar"]) div[data-testid="stCheckbox"] p,
|
||||
section:not([data-testid="stSidebar"]) div[data-testid="stTextInput"] p,
|
||||
section:not([data-testid="stSidebar"]) div[data-testid="stTextArea"] p,
|
||||
section:not([data-testid="stSidebar"]) div[data-testid="stAlertContentInfo"] p {
|
||||
color: var(--text-color) !important;
|
||||
color: var(--text-color) !important;
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
@ -151,98 +151,98 @@ section:not([data-testid="stSidebar"]) div[data-testid="stAlertContentInfo"] p {
|
||||
|
||||
/* --- 4.1 Header --- */
|
||||
.wide-header {
|
||||
width: 100vw;
|
||||
margin-left: calc(-50vw + 50%);
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
border-bottom: 1px solid #ddd;
|
||||
text-align: center;
|
||||
padding-top: 1rem;
|
||||
margin-top: -1.25em;
|
||||
background-color: var(--header-bg);
|
||||
width: 100vw;
|
||||
margin-left: calc(-50vw + 50%);
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
border-bottom: 1px solid #ddd;
|
||||
text-align: center;
|
||||
padding-top: 1rem;
|
||||
margin-top: -1.25em;
|
||||
background-color: var(--header-bg);
|
||||
}
|
||||
|
||||
.titre-header {
|
||||
font-size: 2rem !important;
|
||||
font-weight: bolder !important;
|
||||
color: var(--header-title);
|
||||
font-size: 2rem !important;
|
||||
font-weight: bolder !important;
|
||||
color: var(--header-title);
|
||||
}
|
||||
|
||||
/* --- 4.2 Footer --- */
|
||||
.wide-footer {
|
||||
width: 100vw;
|
||||
margin-left: calc(-50vw + 50%);
|
||||
margin-top: 3rem;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
border-top: 1px solid #ddd;
|
||||
text-align: center;
|
||||
padding-top: 1rem;
|
||||
background-color: var(--footer-bg);
|
||||
width: 100vw;
|
||||
margin-left: calc(-50vw + 50%);
|
||||
margin-top: 3rem;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
border-top: 1px solid #ddd;
|
||||
text-align: center;
|
||||
padding-top: 1rem;
|
||||
background-color: var(--footer-bg);
|
||||
}
|
||||
|
||||
.info-footer {
|
||||
font-size: 1rem !important;
|
||||
font-weight: 800;
|
||||
color: var(--footer-text);
|
||||
font-size: 1rem !important;
|
||||
font-weight: 800;
|
||||
color: var(--footer-text);
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
5. Sidebar
|
||||
========================================== */
|
||||
section[data-testid="stSidebar"] {
|
||||
background-color: #ccc !important;
|
||||
color: #111 !important;
|
||||
background-color: #ccc !important;
|
||||
color: #111 !important;
|
||||
}
|
||||
|
||||
section[data-testid="stSidebar"] .stButton > button {
|
||||
background-color: darkgreen !important;
|
||||
color: white !important;
|
||||
font-weight: bold !important;
|
||||
border: 1px solid #ccc !important;
|
||||
width: 100%;
|
||||
background-color: darkgreen !important;
|
||||
color: white !important;
|
||||
font-weight: bold !important;
|
||||
border: 1px solid #ccc !important;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
section[data-testid="stSidebar"] .decorative-heading {
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
margin-bottom: 0.5rem;
|
||||
text-align: center;
|
||||
color: #145a1a;
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
margin-bottom: 0.5rem;
|
||||
text-align: center;
|
||||
color: #145a1a;
|
||||
}
|
||||
|
||||
section[data-testid="stSidebar"] div[role="radiogroup"] {
|
||||
justify-content: center !important;
|
||||
display: flex !important;
|
||||
gap: 1rem;
|
||||
justify-content: center !important;
|
||||
display: flex !important;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
6. Tables
|
||||
========================================== */
|
||||
table {
|
||||
border: 1px solid var(--table-border) !important;
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin-bottom: 1.5em;
|
||||
border: 1px solid var(--table-border) !important;
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
border: 1px solid var(--table-border) !important;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
border: 1px solid var(--table-border) !important;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
caption {
|
||||
caption-side: top;
|
||||
font-weight: bold;
|
||||
padding: 0.5em;
|
||||
text-align: left;
|
||||
caption-side: bottom;
|
||||
text-align: center;
|
||||
caption-side: top;
|
||||
font-weight: bold;
|
||||
padding: 0.5em;
|
||||
text-align: left;
|
||||
caption-side: bottom;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table[role="table"] th[scope="col"] {
|
||||
background-color: var(--background-color);
|
||||
background-color: var(--background-color);
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
@ -254,99 +254,99 @@ table[role="table"] th[scope="col"] {
|
||||
|
||||
/* --- 7.2 Graphiques --- */
|
||||
.stPlotlyChart text {
|
||||
fill: var(--plot-text) !important;
|
||||
fill: var(--plot-text) !important;
|
||||
}
|
||||
|
||||
.stPlotlyChart text {
|
||||
fill: black !important;
|
||||
text-shadow: none !important;
|
||||
font-weight: bold !important;
|
||||
font-size: 14px !important;
|
||||
font-family: Verdana, sans-serif !important;
|
||||
fill: black !important;
|
||||
text-shadow: none !important;
|
||||
font-weight: bold !important;
|
||||
font-size: 14px !important;
|
||||
font-family: Verdana, sans-serif !important;
|
||||
}
|
||||
|
||||
/* Cache complètement la section d'actions Vega */
|
||||
.vega-actions {
|
||||
display: none !important;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Et aussi le <details> parent, s'il faut tout masquer */
|
||||
details[title="Click to view actions"] {
|
||||
display: none !important;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* --- 7.3 Détails et paragraphes --- */
|
||||
details {
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
padding: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
background-color: var(--background-color);
|
||||
border-color: var(--details-border) !important;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
padding: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
background-color: var(--background-color);
|
||||
border-color: var(--details-border) !important;
|
||||
}
|
||||
|
||||
section:not([data-testid="stSidebar"])
|
||||
div:not[data-testid="stElementContainer"]
|
||||
p:not(#Authentification):not(#Theme) {
|
||||
color: var(--paragraph-color) !important;
|
||||
div:not[data-testid="stElementContainer"]
|
||||
p:not(#Authentification):not(#Theme) {
|
||||
color: var(--paragraph-color) !important;
|
||||
}
|
||||
|
||||
section:not([data-testid="stSidebar"]) hr {
|
||||
background-color: var(--hr-color) !important;
|
||||
background-color: var(--hr-color) !important;
|
||||
}
|
||||
|
||||
/* --- 7.4 Conteneurs de commentaires et tickets --- */
|
||||
.conteneur_commentaire,
|
||||
.conteneur_ticket {
|
||||
background: var(--background-color);
|
||||
padding: 1em;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 1em;
|
||||
border: 1px solid #ccc;
|
||||
background: var(--background-color);
|
||||
padding: 1em;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 1em;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.commentaire_auteur,
|
||||
.ticket_auteur {
|
||||
color: var(--text-color) !important;
|
||||
margin: 0;
|
||||
color: var(--text-color) !important;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.commentaire_contenu,
|
||||
.ticket_contenu {
|
||||
color: var(--text-color) !important;
|
||||
margin: 0.5rem 0 0;
|
||||
color: var(--text-color) !important;
|
||||
margin: 0.5rem 0 0;
|
||||
}
|
||||
|
||||
/* --- 7.5 Blocs mathématiques --- */
|
||||
.math-block {
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin: 1em 0;
|
||||
border: 1px solid var(--math-block-border);
|
||||
border-radius: 10px;
|
||||
background: var(--math-block-bg);
|
||||
font-size: x-large;
|
||||
color: var(--text-color);
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin: 1em 0;
|
||||
border: 1px solid var(--math-block-border);
|
||||
border-radius: 10px;
|
||||
background: var(--math-block-bg);
|
||||
font-size: x-large;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.math-block math {
|
||||
display: inline-block;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
8. Éléments spécifiques
|
||||
========================================== */
|
||||
div.stElementContainer.element-container.st-key-nom_utilisateur {
|
||||
display: none !important;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.st-key-telecharger_fiche_pdf {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-top: 1rem;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.details_introduction {
|
||||
margin-top: 0.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
margin-top: 0.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import streamlit as st
|
||||
from config import ENV
|
||||
from utils.translations import _
|
||||
from utils.persistance import get_session_id
|
||||
|
||||
|
||||
def afficher_entete():
|
||||
@ -11,7 +12,7 @@ def afficher_entete():
|
||||
"""
|
||||
|
||||
if ENV == "dev":
|
||||
header += f"<p>🔧 {_("app.dev_mode")}</p>"
|
||||
header += f"<p>🔧 {_("app.dev_mode")} Session : {get_session_id()}</p>"
|
||||
else:
|
||||
header += f"<p>{_("header.subtitle")}</p>"
|
||||
|
||||
|
||||
11
fabnum.py
11
fabnum.py
@ -1,5 +1,8 @@
|
||||
import utils.persistance
|
||||
utils.persistance.update_session_paths()
|
||||
|
||||
import streamlit as st
|
||||
from utils.persistance import get_champ_statut
|
||||
from utils.persistance import get_champ_statut, get_session_id
|
||||
|
||||
st.set_page_config(
|
||||
page_title="Fabnum – Analyse de chaîne",
|
||||
@ -88,8 +91,6 @@ init_translations()
|
||||
# Pour tester d'autres langues, décommenter cette ligne :
|
||||
set_language("fr")
|
||||
|
||||
session_id = st.context.headers.get("x-session-id")
|
||||
|
||||
#
|
||||
# Important
|
||||
# Avec Selinux, il faut mettre les bons droits :
|
||||
@ -97,6 +98,7 @@ session_id = st.context.headers.get("x-session-id")
|
||||
# sudo semanage fcontext -a -t var_log_t '/var/log/nginx/fabnum-public\.access\.log'
|
||||
# sudo restorecon -v /var/log/nginx/fabnum-public.access.log
|
||||
#
|
||||
session_id = get_session_id()
|
||||
def get_total_bytes_for_session(session_id):
|
||||
total_bytes = 0
|
||||
try:
|
||||
@ -158,7 +160,7 @@ def fermer_page():
|
||||
st.markdown("""</section>""", unsafe_allow_html=True)
|
||||
st.markdown("</main>", unsafe_allow_html=True)
|
||||
|
||||
total_bytes = get_total_bytes_for_session(session_id)
|
||||
total_bytes = get_total_bytes_for_session(get_session_id())
|
||||
|
||||
afficher_pied_de_page()
|
||||
afficher_impact(total_bytes)
|
||||
@ -176,7 +178,6 @@ ia_nalyse_tab = _("navigation.ia_nalyse")
|
||||
plan_d_action_tab = _("navigation.plan_d_action")
|
||||
visualisations_tab = _("navigation.visualisations")
|
||||
|
||||
from utils.persistance import get_champ_statut
|
||||
navigation_onglet = get_champ_statut("navigation_onglet")
|
||||
|
||||
if navigation_onglet == instructions_tab:
|
||||
|
||||
@ -3,10 +3,8 @@ services:
|
||||
#---- Private-GPT services ---------
|
||||
#-----------------------------------
|
||||
|
||||
# Private-GPT service for the Ollama CPU and GPU modes
|
||||
# This service builds from an external Dockerfile and runs the Ollama mode.
|
||||
private-gpt-ollama:
|
||||
image: ${PGPT_IMAGE:-zylonai/private-gpt}:${PGPT_TAG:-0.6.2}-ollama # x-release-please-version
|
||||
image: ${PGPT_IMAGE:-zylonai/private-gpt}:${PGPT_TAG:-0.6.2}-ollama
|
||||
user: root
|
||||
build:
|
||||
context: .
|
||||
@ -29,12 +27,10 @@ services:
|
||||
- ollama-api
|
||||
depends_on:
|
||||
ollama:
|
||||
condition: service_healthy
|
||||
condition: service_started
|
||||
|
||||
# Private-GPT service for the local mode
|
||||
# This service builds from a local Dockerfile and runs the application in local mode.
|
||||
private-gpt-llamacpp-cpu:
|
||||
image: ${PGPT_IMAGE:-zylonai/private-gpt}:${PGPT_TAG:-0.6.2}-llamacpp-cpu # x-release-please-version
|
||||
image: ${PGPT_IMAGE:-zylonai/private-gpt}:${PGPT_TAG:-0.6.2}-llamacpp-cpu
|
||||
user: root
|
||||
build:
|
||||
context: .
|
||||
@ -56,22 +52,8 @@ services:
|
||||
#---- Ollama services --------------
|
||||
#-----------------------------------
|
||||
|
||||
# Traefik reverse proxy for the Ollama service
|
||||
# This will route requests to the Ollama service based on the profile.
|
||||
ollama:
|
||||
image: traefik:v2.10
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD",
|
||||
"sh",
|
||||
"-c",
|
||||
"wget -q --spider http://ollama:11434 || exit 1",
|
||||
]
|
||||
interval: 10s
|
||||
retries: 3
|
||||
start_period: 5s
|
||||
timeout: 5s
|
||||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
command:
|
||||
@ -86,24 +68,26 @@ services:
|
||||
- ./.docker/router.yml:/etc/router.yml:ro
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
security_opt:
|
||||
- label:disable
|
||||
profiles:
|
||||
- ""
|
||||
- ollama-cpu
|
||||
- ollama-cuda
|
||||
- ollama-api
|
||||
|
||||
# Ollama service for the CPU mode
|
||||
ollama-cpu:
|
||||
image: ollama/ollama:latest
|
||||
ports:
|
||||
- "127.0.0.1:11434:11434"
|
||||
volumes:
|
||||
- ./models:/root/.ollama:Z
|
||||
healthcheck:
|
||||
disable: true
|
||||
profiles:
|
||||
- ""
|
||||
- ollama-cpu
|
||||
|
||||
# Ollama service for the CUDA mode
|
||||
ollama-cuda:
|
||||
image: ollama/ollama:latest
|
||||
ports:
|
||||
|
||||
@ -8,22 +8,17 @@ from pathlib import Path
|
||||
|
||||
load_dotenv(".env")
|
||||
|
||||
def initialise():
|
||||
SAVE_SESSIONS_PATH.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def get_session_id():
|
||||
if "session_id" not in st.session_state:
|
||||
session_id = st.context.headers.get("x-session-id", "anonymous")
|
||||
st.session_state["session_id"] = session_id
|
||||
else:
|
||||
session_id = st.session_state["session_id"]
|
||||
def get_session_id() -> str:
|
||||
session_id = st.context.headers.get("x-session-id", "anonymous")
|
||||
return session_id
|
||||
|
||||
SAVE_STATUT = os.getenv("SAVE_STATUT", "statut_general.json")
|
||||
session_id = get_session_id()
|
||||
SAVE_SESSIONS_PATH = Path(f"tmp/sessions/{session_id}")
|
||||
SAVE_STATUT_PATH = SAVE_SESSIONS_PATH / SAVE_STATUT
|
||||
initialise()
|
||||
def update_session_paths():
|
||||
global SAVE_STATUT, SAVE_SESSIONS_PATH, SAVE_STATUT_PATH
|
||||
|
||||
SAVE_STATUT = os.getenv("SAVE_STATUT", "statut_general.json")
|
||||
SAVE_SESSIONS_PATH = Path(f"tmp/sessions/{get_session_id()}")
|
||||
SAVE_SESSIONS_PATH.mkdir(parents=True, exist_ok=True)
|
||||
SAVE_STATUT_PATH = SAVE_SESSIONS_PATH / SAVE_STATUT
|
||||
|
||||
def _maj_champ(fichier, cle: str, contenu: str = "") -> bool:
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user