Skip to content

Commit 30e3d24

Browse files
committed
embd include name
1 parent e37f276 commit 30e3d24

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

kcpp_docs.embd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@
15041504
"requestBody": {
15051505
"content": {
15061506
"application/json": {
1507-
"example": {},
1507+
"example": {"model": "kcpp", "input": "Niko the Kobold is in town today."},
15081508
"schema": {
15091509
"properties": {},
15101510
"type": "object"

koboldcpp.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
handle = None
5959
friendlymodelname = "inactive"
6060
friendlysdmodelname = "inactive"
61+
friendlyembeddingsmodelname = "inactive"
6162
lastgeneratedcomfyimg = b''
6263
fullsdmodelpath = "" #if empty, it's not initialized
6364
mmprojpath = "" #if empty, it's not initialized
@@ -2541,7 +2542,7 @@ def noscript_webui(self):
25412542
def do_GET(self):
25422543
global embedded_kailite, embedded_kcpp_docs, embedded_kcpp_sdui
25432544
global last_req_time, start_time
2544-
global savedata_obj, 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
2545+
global savedata_obj, 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, friendlyembeddingsmodelname
25452546
self.path = self.path.rstrip('/')
25462547
response_body = None
25472548
content_type = 'application/json'
@@ -3289,7 +3290,7 @@ def do_POST(self):
32893290
for od in gen["data"]:
32903291
outdatas.append([{"object":"embedding","index":odidx,"embedding":od}])
32913292
odidx += 1
3292-
genresp = (json.dumps({"object":"list","data":outdatas,"model":"koboldcpp-embeddings","usage":{"prompt_tokens":gen["count"],"total_tokens":gen["count"]}}).encode())
3293+
genresp = (json.dumps({"object":"list","data":outdatas,"model":friendlyembeddingsmodelname,"usage":{"prompt_tokens":gen["count"],"total_tokens":gen["count"]}}).encode())
32933294
self.send_response(200)
32943295
self.send_header('content-length', str(len(genresp)))
32953296
self.end_headers(content_type='application/json')
@@ -5495,7 +5496,7 @@ def main(launch_args, default_args):
54955496

54965497
def kcpp_main_process(launch_args, g_memory=None, gui_launcher=False):
54975498
global embedded_kailite, embedded_kcpp_docs, embedded_kcpp_sdui, start_time, exitcounter, global_memory, using_gui_launcher
5498-
global libname, args, friendlymodelname, friendlysdmodelname, fullsdmodelpath, mmprojpath, password, fullwhispermodelpath, ttsmodelpath, embeddingsmodelpath
5499+
global libname, args, friendlymodelname, friendlysdmodelname, fullsdmodelpath, mmprojpath, password, fullwhispermodelpath, ttsmodelpath, embeddingsmodelpath, friendlyembeddingsmodelname
54995500

55005501
start_server = True
55015502

@@ -5945,6 +5946,9 @@ def kcpp_main_process(launch_args, g_memory=None, gui_launcher=False):
59455946
embeddingsmodelpath = os.path.abspath(embeddingsmodelpath)
59465947
loadok = embeddings_load_model(embeddingsmodelpath)
59475948
print("Load Embeddings Model OK: " + str(loadok))
5949+
friendlyembeddingsmodelname = os.path.basename(embeddingsmodelpath)
5950+
friendlyembeddingsmodelname = os.path.splitext(friendlyembeddingsmodelname)[0]
5951+
friendlyembeddingsmodelname = sanitize_string(friendlyembeddingsmodelname)
59485952
if not loadok:
59495953
exitcounter = 999
59505954
exit_with_error(3,"Could not load Embeddings model!")

0 commit comments

Comments
 (0)