Module: OllamaChat::PersonaeManagement

Included in:
Chat
Defined in:
lib/ollama_chat/personae_management.rb

Overview

Module for managing personas in Ollama chat application

This module provides functionality to manage persona files, including creating, reading, updating, and deleting persona definitions stored as Markdown files in the personae directory.

Instance Method Summary collapse

Instance Method Details

#assistantString, ...

Returns the name of the current default persona.

If the default persona is set to :none or is not configured, it returns nil.

Returns:

  • (String, Symbol, nil)

    the name of the default persona, or nil if none is set.



31
32
33
34
35
# File 'lib/ollama_chat/personae_management.rb', line 31

def assistant
  if default_persona_name && default_persona_name != :none
    default_persona_name
  end
end

#default_persona_profileString?

Retrieves the formatted roleplay prompt for the current default persona.

Returns:

  • (String, nil)

    The formatted persona profile or nil if none set



18
19
20
21
22
# File 'lib/ollama_chat/personae_management.rb', line 18

def default_persona_profile
  if persona = default_persona and persona.exist?
    play_persona(persona)
  end
end

#initial_persona_nameString?

The initial_persona_name method retrieves the initial persona for the chat session.

Returns:

  • (String, nil)

    the persona name or nil if not set



11
12
13
# File 'lib/ollama_chat/personae_management.rb', line 11

def initial_persona_name
  session&.default_persona_name
end