Compare commits
3 Commits
f5fc985be9
...
47cc5fae55
Author | SHA1 | Date | |
---|---|---|---|
|
47cc5fae55 | ||
|
df753d77ee | ||
|
ade9944159 |
@ -7,11 +7,12 @@
|
|||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers/features/python:1": {}
|
"ghcr.io/devcontainers/features/python:1": {}
|
||||||
},
|
},
|
||||||
"onCreateCommand": "pip install openai; apt update; apt install git",
|
"onCreateCommand": "pip install openai",
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"pomdtr.secrets"
|
"pomdtr.secrets",
|
||||||
|
"ms-python.python"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
src/aidgaf/aidgaf-server/__main__.py
Normal file
3
src/aidgaf/aidgaf-server/__main__.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import server
|
||||||
|
|
||||||
|
server.main()
|
@ -13,9 +13,7 @@ openai.organization = "org-hNNV1yHjZp7T3pn5pdZWaKLm"
|
|||||||
|
|
||||||
|
|
||||||
URL="https://api.openai.com/v1/completions"
|
URL="https://api.openai.com/v1/completions"
|
||||||
PROMPTS=["Say \"USERNAME does not give a fuck\" in a thoughtful and clever paragraph of 5 sentences.",
|
|
||||||
"Say \"USERNAME does not give a fuck\" in a Dr Suess poem.",
|
|
||||||
"Tell me all about how much \"USERNAME does not give a fuck\" using your most colorful words."]
|
|
||||||
DATA = {"model": "text-davinci-003",
|
DATA = {"model": "text-davinci-003",
|
||||||
"prompt": PROMPTS[0],
|
"prompt": PROMPTS[0],
|
||||||
"temperature":1,
|
"temperature":1,
|
||||||
@ -49,6 +47,7 @@ class IDGAFServer(BaseHTTPRequestHandler):
|
|||||||
def get_response_base_object(text):
|
def get_response_base_object(text):
|
||||||
resultObject={}
|
resultObject={}
|
||||||
resultObject["message"]={}
|
resultObject["message"]={}
|
||||||
|
resultObject["service"]="AIDGAF Server"
|
||||||
resultObject["message"]["data"]={}
|
resultObject["message"]["data"]={}
|
||||||
resultObject["message"]["data"]["resultObject"]=text
|
resultObject["message"]["data"]["resultObject"]=text
|
||||||
resultObject["timestamp"]=datetime.utcnow().timestamp()
|
resultObject["timestamp"]=datetime.utcnow().timestamp()
|
||||||
@ -65,7 +64,7 @@ def parse_idgaf_request(command):
|
|||||||
return [gpt_response.status_code,json_result]
|
return [gpt_response.status_code,json_result]
|
||||||
|
|
||||||
def get_prompt(command):
|
def get_prompt(command):
|
||||||
my_prompt=random.choice(PROMPTS)
|
my_prompt=random.choice(settings.PROMPTS)
|
||||||
my_prompt=my_prompt.replace("USERNAME",command['message']['data']['username'])
|
my_prompt=my_prompt.replace("USERNAME",command['message']['data']['username'])
|
||||||
|
|
||||||
print("Prompt selected: "+my_prompt)
|
print("Prompt selected: "+my_prompt)
|
||||||
|
@ -4,7 +4,7 @@ from http.server import HTTPServer
|
|||||||
import settings
|
import settings
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def main():
|
||||||
webServer = HTTPServer((settings.HOSTNAME, settings.SERVERPORT), idgaf.IDGAFServer)
|
webServer = HTTPServer((settings.HOSTNAME, settings.SERVERPORT), idgaf.IDGAFServer)
|
||||||
print("Server started http://%s:%s" % (settings.HOSTNAME, settings.SERVERPORT))
|
print("Server started http://%s:%s" % (settings.HOSTNAME, settings.SERVERPORT))
|
||||||
|
|
||||||
@ -15,3 +15,6 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
webServer.server_close()
|
webServer.server_close()
|
||||||
print("Server stopped.")
|
print("Server stopped.")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
@ -4,4 +4,10 @@ HOSTNAME:str = os.getenv('HOSTNAME') #localhost
|
|||||||
#The port to broadcast the server
|
#The port to broadcast the server
|
||||||
SERVERPORT:int = int(os.getenv('SERVERPORT')) #8087
|
SERVERPORT:int = int(os.getenv('SERVERPORT')) #8087
|
||||||
#The API key for OpenAI
|
#The API key for OpenAI
|
||||||
APIKEY:str = os.getenv('APIKEY') #secret key
|
APIKEY:str = os.getenv('APIKEY') #secret key
|
||||||
|
#The hash key
|
||||||
|
HASHKEY:str = os.getenv('HASHKEY') #shared secret for hmac of message
|
||||||
|
#The prompts used for OpenAI.
|
||||||
|
PROMPTS=["Say \"USERNAME does not give a fuck\" in a thoughtful and clever paragraph of 5 sentences.",
|
||||||
|
"Say \"USERNAME does not give a fuck\" in a Dr Suess poem.",
|
||||||
|
"Tell me all about how much \"USERNAME does not give a fuck\" using your most colorful words."]
|
Loading…
x
Reference in New Issue
Block a user