mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Added OpenAI API support
Added in-browser Save/Load/New Story controls (Force a full refresh in your browser!) Fixed adding InferKit API key if client.settings already exists Added cmd calls to bat files so they'll stay open on error Wait animation now hidden on start state/restart
This commit is contained in:
26
fileops.py
26
fileops.py
@ -1,5 +1,7 @@
|
||||
import tkinter as tk
|
||||
from tkinter import filedialog
|
||||
from os import getcwd, listdir, path
|
||||
import json
|
||||
|
||||
#==================================================================#
|
||||
# Generic Method for prompting for file path
|
||||
@ -50,4 +52,26 @@ def getdirpath(dir, title):
|
||||
if(path != "" and path != None):
|
||||
return path
|
||||
else:
|
||||
return None
|
||||
return None
|
||||
|
||||
#==================================================================#
|
||||
# Returns an array of dicts containing story files in /stories
|
||||
#==================================================================#
|
||||
def getstoryfiles():
|
||||
list = []
|
||||
for file in listdir(getcwd()+"/stories"):
|
||||
if file.endswith(".json"):
|
||||
ob = {}
|
||||
ob["name"] = file.replace(".json", "")
|
||||
f = open(getcwd()+"/stories/"+file, "r")
|
||||
js = json.load(f)
|
||||
f.close()
|
||||
ob["actions"] = len(js["actions"])
|
||||
list.append(ob)
|
||||
return list
|
||||
|
||||
#==================================================================#
|
||||
# Returns True if json file exists with requested save name
|
||||
#==================================================================#
|
||||
def saveexists(name):
|
||||
return path.exists(getcwd()+"/stories/"+name+".json")
|
Reference in New Issue
Block a user