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

Function init_session

03-ai-agent-for-devops/code/12/app.py:109–127  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

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