conf added
This commit is contained in:
parent
d91c277ada
commit
5d9a00772d
2 changed files with 45 additions and 2 deletions
10
Simbriefimport.example
Normal file
10
Simbriefimport.example
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"AI": {
|
||||
"Model": "gpt-4.1-mini",
|
||||
"Token": "SECRET TOKE"
|
||||
},
|
||||
"Prompt": {
|
||||
"CptPrompt": "Du bist der Pilot auf einem Linienflug und begrüßt deine Fluggäste am Startflughafen.",
|
||||
"PurserPrompt": "Du bist Purser auf einem Flug an das in der METAR genannte Ziel.Der Flug ist noch nicht vollendet! Informiere die Fluggäste im Zuge der bevorstehenden Landung über die aktuelle Wetterlage hinsichtlich Temperatur, Wind und Sonne. Verhalte dich dabei wie die Wetterfee aus den Nachrichten und beschränke die Antwort auf maximal 2 kurze Sätze. Die Windrichtung bitte ignorieren. Nenne dabei den Zielflughafen mit Namen. Vermeide Aussagen wie 'Willkommen'. Sei dabei freundlich und kundenorientiert."
|
||||
}
|
||||
}
|
||||
|
|
@ -2,9 +2,10 @@ import requests
|
|||
import json
|
||||
from pathlib import Path
|
||||
from datetime import datetime, timezone
|
||||
from openai import OpenAI
|
||||
import os
|
||||
import sys
|
||||
|
||||
from aiohttp import payload_type
|
||||
from proto import Field
|
||||
|
||||
USERNAME = "hubobel"
|
||||
URL = "https://www.simbrief.com/api/xml.fetcher.php"
|
||||
|
|
@ -16,7 +17,36 @@ Pfad = 'Universal_txts/Windows'
|
|||
|
||||
ordnerneu = Path(Pfad + '/neu/')
|
||||
ordnerneu.mkdir(exist_ok=True)
|
||||
def conf():
|
||||
appname = os.path.basename(sys.argv[0])
|
||||
appname = appname.replace(".py", ".conf")
|
||||
absFilePath = os.path.abspath(__file__)
|
||||
absFilePath = absFilePath.replace(".py", ".conf")
|
||||
|
||||
if os.path.isfile(absFilePath) is False:
|
||||
print(appname + ' scheint es nicht zu geben.')
|
||||
print('Ich lege eine neue Datei ' + appname + ' an.')
|
||||
passw = {'Prompt':
|
||||
{
|
||||
"PurserPrompt": "",
|
||||
"CptPrompt": ""
|
||||
|
||||
},
|
||||
'AI':
|
||||
{
|
||||
"Token": "",
|
||||
"Model": ""
|
||||
}
|
||||
}
|
||||
|
||||
print(str(appname) + ' bitte entsprechend befüllen.')
|
||||
with open(absFilePath, 'w') as fp:
|
||||
json.dump(passw, fp, sort_keys=True, indent=4)
|
||||
quit()
|
||||
else:
|
||||
with open(absFilePath) as file:
|
||||
passw = json.load(file)
|
||||
return passw
|
||||
def minuten_zu_zeit(minuten) -> str:
|
||||
minuten = int(minuten)
|
||||
stunden = minuten // 60 # volle Stunden
|
||||
|
|
@ -62,6 +92,7 @@ def unix_to_datetime(timestamp: int) -> str:
|
|||
return datetime.fromtimestamp(timestamp, tz=timezone.utc).strftime("%d.%m.%Y %H:%M:%S")
|
||||
|
||||
|
||||
|
||||
resp = requests.get(URL, params=params, timeout=15)
|
||||
resp.raise_for_status()
|
||||
data = resp.json() # dict
|
||||
|
|
@ -126,3 +157,5 @@ for datei in Path(Pfad).glob("*.txt"):
|
|||
with open(dateineu,'w', encoding="utf-8") as e:
|
||||
e.write(inhalt_neu)
|
||||
|
||||
passw = conf()
|
||||
print(passw['AI']['Token'])
|
||||
Loading…
Add table
Add a link
Reference in a new issue