ConversationServer (fnord v0.8.27)
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 conversation object.
Get the list of messages in the current conversation.
Callback implementation for GenServer.init/1
.
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 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_conversation(pid()) :: Store.Project.Conversation.t()
Get the current conversation object.
@spec get_messages(pid()) :: [AI.Util.msg()]
Get the list of messages in the current conversation.
Callback implementation for GenServer.init/1
.
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.
@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.