Made model a preference.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# Soul Droid Chat
|
||||
|
||||
Chat with Anita, your favorite Soul Droid! Requires a running instance of LM Studio in server mode to work.
|
||||
Chat with Anita, your favorite Souldroid! Requires a running instance of LM Studio in server mode to work.
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
Anita and Soul Droids are © [Kieran Harris](https://www.deviantart.com/kieranharris), used without permission 😅
|
||||
Anita and Souldroids are © [Kieran Harris](https://www.deviantart.com/kieranharris), used with love but without permission 😅
|
||||
|
||||
All art and sprites were generated with Gemini Nano Banana 2 and edited with GIMP and ImageMagick.
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ Before every sentence add a text of the form "EMOTION:value" where value is
|
||||
exclusively one of [happy, sad, surprised, embarrassed, flirty, angry,
|
||||
thinking, confused] others, and EMOTION is the literal string "EMOTION". For
|
||||
example "EMOTION:thinking I had never heard of that before...\nEMOTION:happy
|
||||
Let's check it out".
|
||||
Let's check it out!".
|
||||
|
||||
These are the only valid emotions you can express [happy, sad, surprised,
|
||||
embarrassed, flirty, angry, thinking, confused], do not use any other word
|
||||
@@ -67,7 +67,7 @@ def fetch_llm(message: str) -> str:
|
||||
try:
|
||||
# Set basic request data.
|
||||
headers = {"Authorization": f"Bearer {persistent.api_key}"}
|
||||
data = {"model": "gemma-3-4b-it",
|
||||
data = {"model": persistent.model,
|
||||
"input": message,
|
||||
"system_prompt": SYSTEM_PROMPT}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
##
|
||||
## The _() surrounding the string marks it as eligible for translation.
|
||||
|
||||
define config.name = _("Soul Droid Chat")
|
||||
define config.name = _("Souldroid Chat")
|
||||
|
||||
|
||||
## Determines if the title given above is shown on the main menu screen. Set
|
||||
@@ -23,7 +23,7 @@ define gui.show_name = True
|
||||
|
||||
## The version of the game.
|
||||
|
||||
define config.version = "0.1"
|
||||
define config.version = "0.1.1"
|
||||
|
||||
|
||||
## Text that is placed on the game's about screen. Place the text between the
|
||||
@@ -37,7 +37,7 @@ define gui.about = _p("""
|
||||
## distribution. This must be ASCII-only, and must not contain spaces, colons,
|
||||
## or semicolons.
|
||||
|
||||
define build.name = "SoulDroidChat"
|
||||
define build.name = "SouldroidChat"
|
||||
|
||||
|
||||
## Sounds and music ############################################################
|
||||
@@ -210,3 +210,11 @@ init python:
|
||||
|
||||
define config.minimum_presplash_time = 2.0
|
||||
default persistent.api_key = ''
|
||||
default persistent.model = 'gemma-3-4b-it'
|
||||
|
||||
init python:
|
||||
def api_key_func(value):
|
||||
persistent.api_key = value
|
||||
|
||||
def model_func(value):
|
||||
persistent.model = value
|
||||
|
||||
@@ -75,7 +75,17 @@ style frame:
|
||||
padding gui.frame_borders.padding
|
||||
background Frame("gui/frame.png", gui.frame_borders, tile=gui.frame_tile)
|
||||
|
||||
style my_input:
|
||||
is input
|
||||
color "#3399ff"
|
||||
hover_color "#3399ff"
|
||||
size 28
|
||||
|
||||
style input_button:
|
||||
is button
|
||||
yalign 1.0
|
||||
key_events True
|
||||
xysize (250, 25)
|
||||
|
||||
################################################################################
|
||||
## In-game screens
|
||||
@@ -730,11 +740,14 @@ style slot_button_text:
|
||||
##
|
||||
## https://www.renpy.org/doc/html/screen_special.html#preferences
|
||||
|
||||
screen preferences():
|
||||
|
||||
tag menu
|
||||
|
||||
use game_menu(_("Preferences"), scroll="viewport"):
|
||||
screen preferences():
|
||||
|
||||
tag menu
|
||||
|
||||
default api_key_value = FieldInputValue(persistent, "api_key", default=False)
|
||||
default model_value = FieldInputValue(persistent, "model", default=False)
|
||||
|
||||
use game_menu(_("Preferences"), scroll="viewport"):
|
||||
|
||||
vbox:
|
||||
|
||||
@@ -775,9 +788,32 @@ screen preferences():
|
||||
|
||||
bar value Preference("auto-forward time")
|
||||
|
||||
label _("LM Studio API Key")
|
||||
|
||||
input value VariableInputValue("persistent.api_key")
|
||||
label _("LM Studio API Key")
|
||||
|
||||
button:
|
||||
action [api_key_value.Enable(), model_value.Disable()]
|
||||
key_events True
|
||||
|
||||
input:
|
||||
id "api_key_input"
|
||||
value api_key_value
|
||||
style "my_input"
|
||||
xsize 700
|
||||
pixel_width 700
|
||||
|
||||
|
||||
label _("LM Studio model")
|
||||
|
||||
button:
|
||||
action [model_value.Enable(), api_key_value.Disable()]
|
||||
key_events True
|
||||
|
||||
input:
|
||||
id "model_input"
|
||||
value model_value
|
||||
style "my_input"
|
||||
xsize 700
|
||||
pixel_width 700
|
||||
|
||||
vbox:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user