MCPcopy Create free account
hub / github.com/VersusControl/devops-ai-guidelines / init_session

Function init_session

03-ai-agent-for-devops/code/13/app.py:113–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

111# Session state + memory stores
112# ─────────────────────────────────────────────────────────────
113def init_session():
114 Config.validate()
115
116 # Initialise memory stores once
117 if "chat_store" not in st.session_state:
118 st.session_state.chat_store = ChatStore(Config.MEMORY_DIR)
119 if "incident_store" not in st.session_state:
120 st.session_state.incident_store = IncidentStore(Config.MEMORY_DIR)
121
122 # Load persisted conversation (survives page refreshes)
123 if "messages" not in st.session_state:
124 st.session_state.messages = st.session_state.chat_store.load()
125
126 # Build the agent with past-incident context
127 if "agent" not in st.session_state:
128 incident_store = st.session_state.incident_store
129 recent = incident_store.get_recent(5)
130 context = incident_store.format_for_prompt(recent)
131 st.session_state.agent = LogAnalyzerAgent(incident_context=context)
132
133
134# ─────────────────────────────────────────────────────────────

Callers 1

mainFunction · 0.70

Calls 7

ChatStoreClass · 0.90
IncidentStoreClass · 0.90
LogAnalyzerAgentClass · 0.90
validateMethod · 0.45
loadMethod · 0.45
get_recentMethod · 0.45
format_for_promptMethod · 0.45

Tested by

no test coverage detected