Services.Conversation (fnord v0.8.83)
View SourceSummary
Functions
Append a new message to the conversation. Does not save the conversation.
Returns a specification to start this module under a supervisor.
Get the current agent instance.
Get the current conversation object.
Get the conversation ID of the current conversation.
Get the current session memory list for this conversation.
Get the list of messages in the current conversation.
Get the conversation metadata.
Get a response from the AI.Agent.Coordinator. The opts is passed directly
to AI.Agent.get_response/2 after converting to a map and adding the
:conversation server's pid.
Callback implementation for GenServer.init/1.
Request an interrupt by enqueuing a new user message to be injected at the next safe point.
Load an existing conversation from persistent storage. If conversation_id
is nil, a new conversation is created. If a conversation with the given ID
does not exist or is corrupt, an error is returned.
Replace the session memory list for this conversation.
Replace all messages in the conversation with a new list of messages. This does not save the conversation.
Save the current conversation to persistent storage. This updates the conversation's timestamp and writes the messages to disk. If the conversation is successfully saved, the server state is reloaded with the latest data.
Functions
@spec append_msg(AI.Util.msg(), pid()) :: :ok
Append a new message to the conversation. Does not save the conversation.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec get_agent(pid()) :: AI.Agent.t()
Get the current agent instance.
@spec get_conversation(pid()) :: Store.Project.Conversation.t()
Get the current conversation object.
Get the conversation ID of the current conversation.
Get the current session memory list for this conversation.
@spec get_messages(pid()) :: [AI.Util.msg()]
Get the list of messages in the current conversation.
Get the conversation metadata.
Get a response from the AI.Agent.Coordinator. The opts is passed directly
to AI.Agent.get_response/2 after converting to a map and adding the
:conversation server's pid.
Callback implementation for GenServer.init/1.
Request an interrupt by enqueuing a new user message to be injected at the next safe point.
Load an existing conversation from persistent storage. If conversation_id
is nil, a new conversation is created. If a conversation with the given ID
does not exist or is corrupt, an error is returned.
Replace the session memory list for this conversation.
This does not save the conversation to disk; callers should invoke save/1
if they want the updated memory list to be persisted.
@spec replace_msgs([AI.Util.msg()], pid()) :: :ok
Replace all messages in the conversation with a new list of messages. This does not save the conversation.
@spec save(pid()) :: {:ok, Store.Project.Conversation.t()} | {:error, any()}
Save the current conversation to persistent storage. This updates the conversation's timestamp and writes the messages to disk. If the conversation is successfully saved, the server state is reloaded with the latest data.