Skip to content

Commit 44720fb

Browse files
committed
capabilities printout
1 parent 9643296 commit 44720fb

File tree

2 files changed

+44
-9
lines changed

2 files changed

+44
-9
lines changed

koboldcpp.py

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,17 @@ def string_contains_or_overlaps_sequence_substring(inputstr, sequences):
651651
return True
652652
return False
653653

654+
def get_capabilities():
655+
global has_multiplayer, KcppVersion, friendlymodelname, friendlysdmodelname, fullsdmodelpath, mmprojpath, password, fullwhispermodelpath, ttsmodelpath
656+
has_llm = not (friendlymodelname=="inactive")
657+
has_txt2img = not (friendlysdmodelname=="inactive" or fullsdmodelpath=="")
658+
has_vision = (mmprojpath!="")
659+
has_password = (password!="")
660+
has_whisper = (fullwhispermodelpath!="")
661+
has_search = True if args.websearch else False
662+
has_tts = (ttsmodelpath!="")
663+
return {"result":"KoboldCpp", "version":KcppVersion, "protected":has_password, "llm":has_llm, "txt2img":has_txt2img,"vision":has_vision,"transcribe":has_whisper,"multiplayer":has_multiplayer,"websearch":has_search,"tts":has_tts}
664+
654665
def read_gguf_metadata(file_path):
655666
chunk_size = 8192 # read only first 8kb of file
656667
try:
@@ -2199,7 +2210,7 @@ def noscript_webui(self):
21992210

22002211
def do_GET(self):
22012212
global embedded_kailite, embedded_kcpp_docs, embedded_kcpp_sdui
2202-
global has_multiplayer, multiplayer_turn_major, multiplayer_turn_minor, multiplayer_story_data_compressed, multiplayer_dataformat, multiplayer_lastactive, maxctx, maxhordelen, friendlymodelname, lastgeneratedcomfyimg, KcppVersion, totalgens, preloaded_story, exitcounter, currentusergenkey, friendlysdmodelname, fullsdmodelpath, mmprojpath, password, fullwhispermodelpath, ttsmodelpath
2213+
global has_multiplayer, multiplayer_turn_major, multiplayer_turn_minor, multiplayer_story_data_compressed, multiplayer_dataformat, multiplayer_lastactive, maxctx, maxhordelen, friendlymodelname, lastgeneratedcomfyimg, KcppVersion, totalgens, preloaded_story, exitcounter, currentusergenkey, friendlysdmodelname, fullsdmodelpath, mmprojpath, password
22032214
self.path = self.path.rstrip('/')
22042215
response_body = None
22052216
content_type = 'application/json'
@@ -2252,13 +2263,8 @@ def do_GET(self):
22522263
response_body = (json.dumps({"value": maxctx}).encode())
22532264

22542265
elif self.path.endswith(('/api/extra/version')):
2255-
has_txt2img = not (friendlysdmodelname=="inactive" or fullsdmodelpath=="")
2256-
has_vision = (mmprojpath!="")
2257-
has_password = (password!="")
2258-
has_whisper = (fullwhispermodelpath!="")
2259-
has_search = True if args.websearch else False
2260-
has_tts = (ttsmodelpath!="")
2261-
response_body = (json.dumps({"result":"KoboldCpp","version":KcppVersion, "protected":has_password ,"txt2img":has_txt2img,"vision":has_vision,"transcribe":has_whisper,"multiplayer":has_multiplayer,"websearch":has_search,"tts":has_tts}).encode())
2266+
caps = get_capabilities()
2267+
response_body = (json.dumps(caps).encode())
22622268

22632269
elif self.path.endswith(('/api/extra/perf')):
22642270
global last_req_time, start_time
@@ -5200,6 +5206,35 @@ def main(launch_args,start_server=True):
52005206
except Exception:
52015207
print("Could not find Embedded SDUI.")
52025208

5209+
# print enabled modules
5210+
caps = get_capabilities()
5211+
enabledmlist = []
5212+
disabledmlist = []
5213+
apimlist = ["KoboldCppApi"]
5214+
if "llm" in caps and caps["llm"]:
5215+
apimlist.append("OpenAiApi")
5216+
apimlist.append("OllamaApi")
5217+
if "txt2img" in caps and caps["txt2img"]:
5218+
apimlist.append("A1111ForgeApi")
5219+
apimlist.append("ComfyUiApi")
5220+
if "transcribe" in caps and caps["transcribe"]:
5221+
apimlist.append("WhisperTranscribeApi")
5222+
if "tts" in caps and caps["tts"]:
5223+
apimlist.append("XttsApi")
5224+
apimlist.append("OpenAiSpeechApi")
5225+
enabledmlist.append("TextGeneration") if "llm" in caps and caps["llm"] else disabledmlist.append("TextGeneration")
5226+
enabledmlist.append("ImageGeneration") if "txt2img" in caps and caps["txt2img"] else disabledmlist.append("ImageGeneration")
5227+
enabledmlist.append("VoiceRecognition") if "transcribe" in caps and caps["transcribe"] else disabledmlist.append("VoiceRecognition")
5228+
enabledmlist.append("MultimodalVision") if "vision" in caps and caps["vision"] else disabledmlist.append("MultimodalVision")
5229+
enabledmlist.append("NetworkMultiplayer") if "multiplayer" in caps and caps["multiplayer"] else disabledmlist.append("NetworkMultiplayer")
5230+
enabledmlist.append("ApiKeyPassword") if "protected" in caps and caps["protected"] else disabledmlist.append("ApiKeyPassword")
5231+
enabledmlist.append("WebSearchProxy") if "websearch" in caps and caps["websearch"] else disabledmlist.append("WebSearchProxy")
5232+
enabledmlist.append("TextToSpeech") if "tts" in caps and caps["tts"] else disabledmlist.append("TextToSpeech")
5233+
5234+
print(f"======\nActive Modules: {' '.join(enabledmlist)}")
5235+
print(f"Inactive Modules: {' '.join(disabledmlist)}")
5236+
print(f"Enabled APIs: {' '.join(apimlist)}")
5237+
52035238
if args.port_param!=defaultport:
52045239
args.port = args.port_param
52055240

otherarch/tts_adapter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ tts_generation_outputs ttstype_generate(const tts_generation_inputs inputs)
515515

516516
if(ttc_ctx==nullptr || cts_ctx==nullptr)
517517
{
518-
printf("\nWarning: KCPP TTS not initialized!\n");
518+
printf("\nWarning: KCPP TTS not initialized! Make sure both TTS and WavTokenizer models are loaded.\n");
519519
output.data = "";
520520
output.status = 0;
521521
return output;

0 commit comments

Comments
 (0)