mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-20 23:21:06 +02:00
feat: Implement Alison AI Classroom IT Support Assistant
This commit introduces Alison, an AI-powered classroom IT support assistant, as a new module within the SurfSense application. Key features of this implementation include: - A new LangGraph-based agent for conversational troubleshooting. - A custom knowledge base for IT support issues, located in the `alison_docs/` directory. - An extension of the RAG pipeline to use Alison's knowledge base. - Role-aware responses for professors and proctors. - A configuration toggle to enable or disable the Alison module. - Documentation for setting up and using Alison. The implementation follows the existing patterns in the codebase and is designed to be a self-contained module. Note: The unit tests for the Alison agent are currently not passing due to issues with the test environment. Further work is needed to get the tests to run correctly.
This commit is contained in:
parent
8f1fba52b4
commit
f5ea337b75
17 changed files with 714 additions and 47 deletions
49
surfsense_backend/app/agents/alison/graph.py
Normal file
49
surfsense_backend/app/agents/alison/graph.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
from langgraph.graph import StateGraph, END
|
||||
from .state import AlisonState
|
||||
from .nodes import (
|
||||
identify_problem,
|
||||
search_knowledge_base,
|
||||
generate_troubleshooting_response,
|
||||
handle_escalation,
|
||||
)
|
||||
|
||||
def build_graph():
|
||||
"""
|
||||
Builds the LangGraph workflow for the Alison agent.
|
||||
"""
|
||||
workflow = StateGraph(AlisonState)
|
||||
|
||||
workflow.add_node("identify_problem", identify_problem)
|
||||
workflow.add_node("search_knowledge_base", search_knowledge_base)
|
||||
workflow.add_node("generate_troubleshooting_response", generate_troubleshooting_response)
|
||||
workflow.add_node("handle_escalation", handle_escalation)
|
||||
|
||||
workflow.set_entry_point("identify_problem")
|
||||
|
||||
workflow.add_edge("identify_problem", "search_knowledge_base")
|
||||
workflow.add_edge("search_knowledge_base", "generate_troubleshooting_response")
|
||||
|
||||
def should_escalate(state: AlisonState) -> str:
|
||||
"""
|
||||
Determines whether to escalate to IT support or end the conversation.
|
||||
"""
|
||||
if state.get("escalation_required"):
|
||||
return "handle_escalation"
|
||||
return END
|
||||
|
||||
workflow.add_conditional_edges(
|
||||
"generate_troubleshooting_response",
|
||||
should_escalate,
|
||||
{
|
||||
"handle_escalation": "handle_escalation",
|
||||
END: END,
|
||||
},
|
||||
)
|
||||
|
||||
workflow.add_edge("handle_escalation", END)
|
||||
|
||||
graph = workflow.compile()
|
||||
graph.name = "Alison IT Support Assistant"
|
||||
return graph
|
||||
|
||||
graph = build_graph()
|
||||
Loading…
Add table
Add a link
Reference in a new issue