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

Function init_session

03-ai-agent-for-devops/code/14/app.py:116–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

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