Spaces:
Sleeping
Sleeping
""" | |
مكون تهيئة حالة الجلسة المحسن | |
""" | |
import streamlit as st | |
def initialize_session_state(): | |
""" | |
تهيئة متغيرات حالة الجلسة بطريقة محسنة | |
""" | |
# تهيئة متغير حالة المصادقة | |
if 'is_authenticated' not in st.session_state: | |
st.session_state.is_authenticated = False | |
# تهيئة معلومات المستخدم | |
if 'user_info' not in st.session_state: | |
st.session_state.user_info = None | |
# تهيئة المشروع الحالي | |
if 'current_project' not in st.session_state: | |
st.session_state.current_project = None | |
# تهيئة قائمة المشاريع | |
if 'projects' not in st.session_state: | |
st.session_state.projects = [] | |
# تهيئة قائمة المناقصات | |
if 'tenders' not in st.session_state: | |
st.session_state.tenders = [] | |
# تهيئة إعدادات النظام | |
if 'settings' not in st.session_state: | |
st.session_state.settings = { | |
'language': 'ar', | |
'theme': 'light', | |
'notifications_enabled': True, | |
'auto_save': True | |
} | |
# تهيئة متغيرات الوحدات المختلفة | |
_initialize_module_states() | |
def _initialize_module_states(): | |
""" | |
تهيئة متغيرات حالة الجلسة الخاصة بالوحدات المختلفة | |
""" | |
# وحدة التسعير | |
if 'pricing_data' not in st.session_state: | |
st.session_state.pricing_data = {} | |
# وحدة المشاريع | |
if 'project_filters' not in st.session_state: | |
st.session_state.project_filters = { | |
'status': 'all', | |
'date_range': 'all', | |
'client': 'all' | |
} | |
# وحدة تحليل المستندات | |
if 'document_analysis_results' not in st.session_state: | |
st.session_state.document_analysis_results = {} | |
# وحدة تحليل المخاطر | |
if 'risk_analysis_data' not in st.session_state: | |
st.session_state.risk_analysis_data = {} | |
# وحدة التقارير | |
if 'report_settings' not in st.session_state: | |
st.session_state.report_settings = { | |
'type': 'summary', | |
'include_charts': True, | |
'include_tables': True | |
} | |
# وحدة المساعد الذكي | |
if 'ai_assistant_history' not in st.session_state: | |
st.session_state.ai_assistant_history = [] | |