feat(agent): update config parameter type to RunnableConfig in copilot nodes

- Change config parameter type from dict to RunnableConfig | None in llm_call and generate_title functions
- This improves type safety and aligns with LangChain's RunnableConfig usage
- No functional changes, only type annotations updated for better integration
This commit is contained in:
YueGuobin 2026-03-04 12:29:31 +08:00
parent dde2a00c5b
commit 2fe30c69e6

View File

@ -37,6 +37,7 @@ import operator
from typing import Annotated, Literal
from langchain.messages import AnyMessage, SystemMessage, ToolMessage
from langchain_core.runnables import RunnableConfig
from langgraph.graph import END, START, StateGraph
from langgraph.managed.is_last_step import RemainingSteps
from typing_extensions import TypedDict
@ -124,7 +125,7 @@ class MessagesState(TypedDict):
# Define llm call node
def llm_call(state: dict, config: dict = None):
def llm_call(state: dict, config: RunnableConfig | None = None):
"""LLM decides whether to call a tool or not"""
# Extract user authentication info from LangGraph config
@ -226,7 +227,7 @@ def llm_call(state: dict, config: dict = None):
# Define generate title node
def generate_title(state: MessagesState, config: dict = None) -> dict:
def generate_title(state: MessagesState, config: RunnableConfig | None = None) -> dict:
"""
Generate a conversation title using a lightweight assistant LLM (title_model).
This node is only executed when no title has been set yet (first round only).