Fix embedding extraction for weights, commas, etc. This fixes the recent change where 'world' would match 'rld'.

This commit is contained in:
cmdr2 2023-08-29 10:23:05 +05:30
parent a7b0858b22
commit b1cb03962c

View File

@ -1312,9 +1312,11 @@ function getCurrentUserRequest() {
}
function setEmbeddings(task) {
let prompt = task.reqBody.prompt.toLowerCase()
let negativePrompt = task.reqBody.negative_prompt.toLowerCase()
let overallPrompt = prompt + " " + negativePrompt
let prompt = task.reqBody.prompt
let negativePrompt = task.reqBody.negative_prompt
let overallPrompt = (prompt + " " + negativePrompt).toLowerCase()
overallPrompt = overallPrompt.replaceAll(/[^a-z0-9\.]/g, " ") // only allow alpha-numeric and dots
overallPrompt = overallPrompt.split(" ")
let embeddingsTree = modelsOptions["embeddings"]
let embeddings = []