|
@@ -1,16 +1,52 @@ |
|
|
from cli_Context import * |
|
|
from cli_Context import * |
|
|
from llm import * |
|
|
from llm import * |
|
|
|
|
|
from memory import * |
|
|
|
|
|
|
|
|
# Greet the user |
|
|
# Greet the user |
|
|
@llm_by_value |
|
|
@llm_by_value |
|
|
def cli_greetUser( |
|
|
def cli_greetUser( |
|
|
c: cli_Context |
|
|
c: cli_Context |
|
|
) -> cli_Context: |
|
|
) -> cli_Context: |
|
|
c.outputGreeting = "OGS Memory Textual UI" |
|
|
|
|
|
|
|
|
c.outputGreeting = "OGS Memory Command Line Interface" |
|
|
c.recentField = "outputGreeting" |
|
|
c.recentField = "outputGreeting" |
|
|
return c |
|
|
return c |
|
|
#} |
|
|
#} |
|
|
|
|
|
|
|
|
|
|
|
# Ask user to select another item to have a pair of selected items |
|
|
|
|
|
@llm_by_value |
|
|
|
|
|
def cli_shouldPromptSelection( |
|
|
|
|
|
c: cli_Context |
|
|
|
|
|
) -> cli_Context: |
|
|
|
|
|
if ( |
|
|
|
|
|
c.recentField == "cMemory" and |
|
|
|
|
|
c.cMemory.recentField == "selectedItems" and |
|
|
|
|
|
len(c.cMemory.selectedItems) == 1 |
|
|
|
|
|
): |
|
|
|
|
|
c.outputPromptSelection = "Select the second item now:" |
|
|
|
|
|
c.recentField = "outputPromptSelection" |
|
|
|
|
|
return c |
|
|
|
|
|
#} |
|
|
|
|
|
c.recentField = "none" |
|
|
|
|
|
return c |
|
|
|
|
|
#} |
|
|
|
|
|
|
|
|
|
|
|
# Select item |
|
|
|
|
|
@llm_by_value |
|
|
|
|
|
def cli_selectItem( |
|
|
|
|
|
c: cli_Context |
|
|
|
|
|
) -> cli_Context: |
|
|
|
|
|
if ( |
|
|
|
|
|
c.input.isdigit() |
|
|
|
|
|
): |
|
|
|
|
|
id = int(c.input) |
|
|
|
|
|
c.cMemory = memory_selectItem(c.cMemory) |
|
|
|
|
|
c.recentField = "cMemory" |
|
|
|
|
|
return c |
|
|
|
|
|
#} |
|
|
|
|
|
c.recentField = "none" |
|
|
|
|
|
return c |
|
|
|
|
|
#} |
|
|
|
|
|
|
|
|
# Show help (aka commands) |
|
|
# Show help (aka commands) |
|
|
@llm_by_value |
|
|
@llm_by_value |
|
|
def cli_showHelp( |
|
|
def cli_showHelp( |
|
@@ -20,7 +56,7 @@ def cli_showHelp( |
|
|
c.input == "h" or |
|
|
c.input == "h" or |
|
|
c.input == "help" |
|
|
c.input == "help" |
|
|
): |
|
|
): |
|
|
c.outputHelp = "Commands:\n\te, exit, q, quit\n\t\tExit\n\th, help\n\t\tList commands\n" |
|
|
|
|
|
|
|
|
c.outputHelp = "Commands:\n\te, exit, q, quit\n\t\tExit\n\th, help\n\t\tList commands\n\t1, 2, 3, ...\n\t\tSelect item\n" |
|
|
c.recentField = "outputHelp" |
|
|
c.recentField = "outputHelp" |
|
|
return c |
|
|
return c |
|
|
#} |
|
|
#} |
|
|