50 lines
2.0 KiB
Python
50 lines
2.0 KiB
Python
"""this is the settings file for the server. It contains the settings for the server.
|
|
"""
|
|
import os
|
|
from const import UTF8
|
|
|
|
""" The hostname of the server. """
|
|
HOSTNAME: str = os.getenv('HOSTNAME') # localhost or some name
|
|
|
|
""" The API key for OpenAI"""
|
|
APIKEY: str = os.getenv('APIKEY') # secret key from OpenAPI website
|
|
if APIKEY is None:
|
|
raise Exception("APIKEY Environmental Variable must be set")
|
|
""" The port to broadcast the server """
|
|
|
|
"""The URL to send async requests to"""
|
|
ASYNC_URL: str=os.getenv('ASYNC_URL')
|
|
|
|
""" The method to use for async requests. """
|
|
ASYNC_METHOD: str=os.getenv('ASYNC_METHOD')
|
|
|
|
|
|
"""8087 or the port you want to run on. pass in with docker -e command."""
|
|
SERVERPORT: int = 8087
|
|
|
|
|
|
""" The prompts used for OpenAI. When the server receives a request, it will
|
|
randomly select one of these prompts to use."""
|
|
PROMPTS = [
|
|
"Say \"USERNAME does not give a fuck\" using 4 separate Haikus, and be sure to mention they are haikus before or after.",
|
|
"Say \"USERNAME does not give a fuck\" within a 10 line Dr Suess poem." #,
|
|
"Tell me a funny, impossible, story about USERNAME. Make USERNAME seem relatable at the end. Make up an outrageous situation where the moral of the story is: \"USERNAME does not give a fuck\" to this very day.",
|
|
"Say \"USERNAME is completely apethetic and does not give a fuck\" in a verbose manner, using your most colorful words and one metaphor."
|
|
]
|
|
|
|
""" The maximum number of tokens to use in a single OpenAI request. """
|
|
OPEN_AI_MAX_TOKENS = 1000
|
|
|
|
""" The model to use for OpenAI. """
|
|
OPEN_AI_COMPLETION_MODEL = "granite3-dense:2b"
|
|
|
|
""" The temperature to use for OpenAI. 0-2, 0 is basicall repeating the prompt, 2 is more random. """
|
|
TEMPERATURE = 0.8
|
|
|
|
""" The hash key for the server. Leave this blank if you don't want to use it. """
|
|
HASHKEY = bytes(os.getenv('HASHKEY') or "",UTF8) # shared secret for hmac of message
|
|
if (HASHKEY == ""):
|
|
HASHKEY=None
|
|
""" The maximum age of a message in seconds. Only used if HASHKEY is set."""
|
|
MAX_MESSAGE_AGE = 600
|