diva.gui.service_streamlit package

Submodules

diva.gui.service_streamlit.main module

This is the main python function for the generation of the streamlit interface service

diva.gui.service_streamlit.main.main(updating=False)[source]

Build and run the DestinE Chatbot application interface.

This function sets up the application’s main interface and manages its core components, including: - Configuring the Streamlit page layout and initializing authentication. - Setting up the sidebar with navigation options. - Managing the main tabs and their associated content, such as banners, session handling, and tabbed navigation.

Parameters

updatingbool, optional

If True, displays a message indicating that the DIVA feature is currently unavailable due to an update and prevents the full application from loading. Default is False.

Returns

None

diva.gui.service_streamlit.sidebar module

diva.gui.service_streamlit.sidebar.app_sidebar(tab_id)[source]

Configures the sidebar of the DestinE Chatbot application based on the selected tab.

The sidebar is populated with various widgets, such as language selection and a button to clear the conversation, depending on the tab currently active in the application. It also includes static content like the last update time and a logo.

Parameters:

tab_idint

Identifier for the current tab. Different widgets are displayed depending on the tab selected. If tab_id is 1, language selection and a conversation clearing button are provided.

Returns:

dict or None

A dictionary containing the selected sidebar options (clear_conv and langage) if tab_id is 1, or None if no options are provided for the selected tab.

diva.gui.service_streamlit.tab1 module

Tab 1 that contains the chatbot page

diva.gui.service_streamlit.tab1.clear_conversation(source_lang)[source]

Clear all conversation history and reset state

diva.gui.service_streamlit.tab1.get_module_llm()[source]

Imports and returns the default language model module.

This function dynamically imports the module_llm from the llm package and returns the default language model (default_llm) defined within that module.

Returns:

object

The default language model (default_llm) from the module_llm.

diva.gui.service_streamlit.tab1.get_user_input(source_lang, dev_mode)[source]

Get user input from chat or suggested prompts

diva.gui.service_streamlit.tab1.handle_discussion(module_chat, prompt, source_lang)[source]

Handle simple discussion requests

diva.gui.service_streamlit.tab1.handle_visualization(module_chat, module_config, prompt, source_lang, energy_meter, energy_records, user_type, langage)[source]

Handle visualization requests

diva.gui.service_streamlit.tab1.initialize_session_state(module_chat, langage)[source]

Initialize all session state variables

diva.gui.service_streamlit.tab1.main(tab1_options)[source]

Main function for Tab 1 - refactored version

diva.gui.service_streamlit.tab1.process_prompt(module_chat, module_config, prompt, source_lang, energy_meter, energy_records, p, user_type, langage)[source]

Process user prompt and generate appropriate response

diva.gui.service_streamlit.tab1.rebuild_chat_history(source_lang)[source]

Rebuild and display all messages and figures from history

diva.gui.service_streamlit.tab2 module

diva.gui.service_streamlit.tab2.main(tab2_options)[source]

Defines the content and layout of Tab 2, which includes documentation and examples for using the DIVA application.

This function sets up the user interface for Tab 2, providing examples of natural language queries, links to documentation, and information about the available data within the DIVA package. It includes code snippets, links to external resources, and a summary of data availability.

Parameters:

tab2_optionsdict

A dictionary containing options related to the current tab. (Not currently used in this function.)

Returns:

None

Module contents