mirror of
				https://github.com/KoboldAI/KoboldAI-Client.git
				synced 2025-06-05 21:59:24 +02:00 
			
		
		
		
	Show author and SP length in soft prompt menu
This commit is contained in:
		| @@ -4156,7 +4156,8 @@ def spRequest(filename): | |||||||
|         tensor = np.float32(tensor) |         tensor = np.float32(tensor) | ||||||
|     assert not np.isinf(tensor).any() and not np.isnan(tensor).any() |     assert not np.isinf(tensor).any() and not np.isnan(tensor).any() | ||||||
|  |  | ||||||
|     vars.sp_length = tensor.shape[0] |     vars.sp_length = tensor.shape[-2] | ||||||
|  |     vars.spmeta["n_tokens"] = vars.sp_length | ||||||
|  |  | ||||||
|     if(vars.model in ("TPUMeshTransformerGPTJ",)): |     if(vars.model in ("TPUMeshTransformerGPTJ",)): | ||||||
|         rows = tensor.shape[0] |         rows = tensor.shape[0] | ||||||
|   | |||||||
| @@ -161,6 +161,7 @@ def getspfiles(model_dimension: int): | |||||||
|             ob = {} |             ob = {} | ||||||
|         z.close() |         z.close() | ||||||
|         ob["filename"] = file |         ob["filename"] = file | ||||||
|  |         ob["n_tokens"] = shape[-2] | ||||||
|         lst.append(ob) |         lst.append(ob) | ||||||
|     return lst |     return lst | ||||||
|  |  | ||||||
|   | |||||||
| @@ -972,11 +972,14 @@ function buildSPList(ar) { | |||||||
| 	showSPPopup(); | 	showSPPopup(); | ||||||
| 	ar.push({filename: '', name: "[None]"}) | 	ar.push({filename: '', name: "[None]"}) | ||||||
| 	for(var i = 0; i < ar.length; i++) { | 	for(var i = 0; i < ar.length; i++) { | ||||||
| 		var supported = !ar[i].supported | 		var author = !ar[i].author | ||||||
| 			? '' | 			? '' | ||||||
| 			: Object.prototype.toString.call(ar[i].supported) === "[object Array]" | 			: ar[i].author.constructor === Array | ||||||
| 			? "[" + ar[i].supported.join(', ') + "]" | 			? ar[i].author.join(', ') | ||||||
| 			: "[" + ar[i].supported.toString() + "]"; | 			: ar[i].author; | ||||||
|  | 		var n_tokens = !ar[i].n_tokens || !Number.isSafeInteger(ar[i].n_tokens) || ar[i].n_tokens < 1 | ||||||
|  | 			? '' | ||||||
|  | 			: "(" + ar[i].n_tokens + " tokens)"; | ||||||
| 		var filename = ar[i].filename.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/(?=\r|\n)\r?\n?/g, '<br/>'); | 		var filename = ar[i].filename.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/(?=\r|\n)\r?\n?/g, '<br/>'); | ||||||
| 		var name = ar[i].name || ar[i].filename; | 		var name = ar[i].name || ar[i].filename; | ||||||
| 		name = name.length > 120 ? name.slice(0, 117) + '...' : name; | 		name = name.length > 120 ? name.slice(0, 117) + '...' : name; | ||||||
| @@ -992,7 +995,7 @@ function buildSPList(ar) { | |||||||
| 				</div>\ | 				</div>\ | ||||||
| 				<div class=\"flex-row\">\ | 				<div class=\"flex-row\">\ | ||||||
| 					<div>"+desc+"</div>\ | 					<div>"+desc+"</div>\ | ||||||
| 					<div class=\"flex-push-right splistitemsub\">"+supported+"</div>\ | 					<div class=\"flex-push-right splistitemsub\">" + author + "<br/>" + n_tokens + "</div>\ | ||||||
| 				</div>\ | 				</div>\ | ||||||
| 			</div>\ | 			</div>\ | ||||||
| 		</div>"); | 		</div>"); | ||||||
| @@ -1108,7 +1111,7 @@ function updateSPStatItems(items) { | |||||||
| 		stat_sp.closest(".statusicon").removeClass("active"); | 		stat_sp.closest(".statusicon").removeClass("active"); | ||||||
| 		stat_spactive.html(""); | 		stat_spactive.html(""); | ||||||
| 	} else { | 	} else { | ||||||
| 		stat_sp.html("Active soft prompt:"); | 		stat_sp.html("Active soft prompt (" + items[key].n_tokens + " tokens):"); | ||||||
| 		stat_sp.closest(".statusicon").addClass("active"); | 		stat_sp.closest(".statusicon").addClass("active"); | ||||||
| 		stat_spactive.html((items[key].name || key)+" <"+key+">"); | 		stat_spactive.html((items[key].name || key)+" <"+key+">"); | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -1312,6 +1312,7 @@ body.connected .popupfooter, .popupfooter.always-available { | |||||||
|  |  | ||||||
| .splistitemsub { | .splistitemsub { | ||||||
| 	color: #ba9; | 	color: #ba9; | ||||||
|  | 	text-align: right; | ||||||
| } | } | ||||||
|  |  | ||||||
| .splistitem:hover { | .splistitem:hover { | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ | |||||||
| 	<link rel="stylesheet" href="static/bootstrap.min.css"> | 	<link rel="stylesheet" href="static/bootstrap.min.css"> | ||||||
| 	<link rel="stylesheet" href="static/bootstrap-toggle.min.css"> | 	<link rel="stylesheet" href="static/bootstrap-toggle.min.css"> | ||||||
| 	<link rel="stylesheet" href="static/open-iconic-bootstrap.min.css"> | 	<link rel="stylesheet" href="static/open-iconic-bootstrap.min.css"> | ||||||
| 	<link rel="stylesheet" href="static/custom.css?ver=1.16.4n"> | 	<link rel="stylesheet" href="static/custom.css?ver=1.16.4o"> | ||||||
|  |  | ||||||
| 	<script src="static/jquery-3.6.0.min.js"></script> | 	<script src="static/jquery-3.6.0.min.js"></script> | ||||||
| 	<script src="static/jquery-ui.sortable.min.js"></script> | 	<script src="static/jquery-ui.sortable.min.js"></script> | ||||||
| @@ -17,7 +17,7 @@ | |||||||
| 	<script src="static/bootstrap.min.js"></script> | 	<script src="static/bootstrap.min.js"></script> | ||||||
| 	<script src="static/bootstrap-toggle.min.js"></script> | 	<script src="static/bootstrap-toggle.min.js"></script> | ||||||
| 	<script src="static/rangy-core.min.js"></script> | 	<script src="static/rangy-core.min.js"></script> | ||||||
| 	<script src="static/application.js?ver=1.16.4aa"></script> | 	<script src="static/application.js?ver=1.16.4ab"></script> | ||||||
| </head> | </head> | ||||||
| <body> | <body> | ||||||
| 	<input type="file" id="remote-save-select" accept="application/json" style="display:none"> | 	<input type="file" id="remote-save-select" accept="application/json" style="display:none"> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Gnome Ann
					Gnome Ann