Setup to use openwebui instead of openai
This commit is contained in:
parent
78ce7ab02a
commit
0923f41428
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,6 +1,7 @@
|
||||
{
|
||||
"secrets.enabledFolders": [
|
||||
"aidgaf"
|
||||
"aidgaf",
|
||||
"default"
|
||||
],
|
||||
"files.associations": {
|
||||
"[Jj]enkinsfile*": "groovy"
|
||||
|
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
@ -42,7 +42,7 @@ pipeline {
|
||||
sh '#!/bin/sh \n' +
|
||||
'set +e; docker stop aidgaf-server||echo machine stopped; docker rm aidgaf-server||echo machine does not exist; set -e'
|
||||
withCredentials([
|
||||
string(credentialsId: 'OpenAI-API-Token', variable: 'OPEN_AI_TOKEN'),
|
||||
string(credentialsId: 'ai-hacked-your-info-key', variable: 'OPENWEBUI-APIKEY'),
|
||||
string(credentialsId: 'PapaHashingSecret', variable: 'PAPA_HASH'),
|
||||
string(credentialsId: 'PapaAsyncUrl', variable: 'ASYNC_URL'),
|
||||
sshUserPrivateKey(credentialsId: 'dockeruserOn192.168.1.115', keyFileVariable: 'sshkey')]) {
|
||||
@ -50,7 +50,7 @@ pipeline {
|
||||
'mkdir -p ~/.ssh; cp "$sshkey" ~/.ssh/id_rsa'
|
||||
sh '#!/bin/sh \n' +
|
||||
/* groovylint-disable-next-line GStringExpressionWithinString */
|
||||
'docker run --name=aidgaf-server -eSERVERPORT=8087 -eHOSTNAME=0.0.0.0 -eHASHKEY="${PAPA_HASH}" -eAPIKEY="${OPEN_AI_TOKEN}" -eASYNC_METHOD="PATCH" -eASYNC_URL="${ASYNC_URL}" -p8087:8087 -d --restart=always aidgaf'
|
||||
'docker run --name=aidgaf-server -eSERVERPORT=8087 -eHOSTNAME=0.0.0.0 -eHASHKEY="${PAPA_HASH}" -eAPIKEY="${OPENWEBUI-APIKEY}" -eASYNC_METHOD="PATCH" -eASYNC_URL="${ASYNC_URL}" -p8087:8087 -d --restart=always aidgaf'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import requests
|
||||
import settings
|
||||
from const import OPENAI_TIMEOUT
|
||||
|
||||
URL = "https://api.openai.com/v1/completions"
|
||||
URL = "https://ai.hackedyour.info/api/chat/completions"
|
||||
""" The URL for the OpenAI API. """
|
||||
|
||||
DATA = {"model": settings.OPEN_AI_COMPLETION_MODEL,
|
||||
@ -78,9 +78,9 @@ def get_prompt(command) -> dict:
|
||||
Returns:
|
||||
A dictionary containing the data to send to OpenAI.
|
||||
"""
|
||||
replyTo=command['message']['data']['replyTo']
|
||||
replyText=command['message']['data']['replyText']
|
||||
inputText=command['message']['data']['inputText']
|
||||
replyTo=command['message']['data'].get('replyTo',"")
|
||||
replyText=command['message']['data'].get('replyText',"")
|
||||
inputText=command['message']['data'].get('inputText',"")
|
||||
my_prompt = random.choice(settings.PROMPTS)
|
||||
my_prompt = my_prompt.replace(
|
||||
"USERNAME", command['message']['data']['username'])
|
||||
@ -100,9 +100,7 @@ if __name__ == "__main__":
|
||||
INPUT = '''{"service":"papa","message":
|
||||
{"command":"aidgaf","data":{"username":"AdamOutler"},
|
||||
"timestamp":1675725191},
|
||||
"hash":"1bc73914478835d03f9ebdfb46328321d2bb656647e28
|
||||
76d6f162cc1860607fcfca8d825c48e390a6a254ee0835c8a4fe5f
|
||||
9a25795a3a0880ae5a23e9c132cf2"}'''
|
||||
"hash":"1bc73914478835d03f9ebdfb46328321d2bb656647e2876d6f162cc1860607fcfca8d825c48e390a6a254ee0835c8a4fe5f9a25795a3a0880ae5a23e9c132cf2"}'''
|
||||
test_command = json.loads(INPUT)
|
||||
[code, result] = parse_idgaf_request(test_command)
|
||||
print(result)
|
||||
|
@ -36,7 +36,7 @@ PROMPTS = [
|
||||
OPEN_AI_MAX_TOKENS = 500
|
||||
|
||||
""" The model to use for OpenAI. """
|
||||
OPEN_AI_COMPLETION_MODEL = "gpt-4o-mini"
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user