Add playground and fix embeddings
This commit is contained in:
@@ -57,7 +57,16 @@ export const runEmbedding = async (texts: string[], model:EmbeddingModel = 'Xeno
|
||||
extractor = await pipeline('feature-extraction', model);
|
||||
}
|
||||
let result = await extractor(texts, { pooling: 'mean', normalize: true });
|
||||
return (result.data as Float32Array[]) ?? null;
|
||||
console.log(texts, result)
|
||||
const data = result.data as Float32Array
|
||||
|
||||
const lenPerText = data.length / texts.length
|
||||
let res:Float32Array[] = []
|
||||
for(let i = 0; i < texts.length; i++){
|
||||
res.push(data.subarray(i * lenPerText, (i + 1) * lenPerText))
|
||||
}
|
||||
console.log(res)
|
||||
return res ?? [];
|
||||
}
|
||||
|
||||
export const runImageEmbedding = async (dataurl:string) => {
|
||||
|
||||
@@ -986,7 +986,7 @@ export function checkCharOrder() {
|
||||
const charId = db.characters[i].chaId
|
||||
charIdList.push(charId)
|
||||
if(!ordered.includes(charId)){
|
||||
if(charId !== '§temp'){
|
||||
if(charId !== '§temp' && charId !== '§playground'){
|
||||
db.characterOrder.push(charId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ export const ShowVN = writable(false)
|
||||
export const SettingsMenuIndex = writable(-1)
|
||||
export const CurrentVariablePointer = writable({} as {[key:string]: string|number|boolean})
|
||||
export const OpenRealmStore = writable(false)
|
||||
export const PlaygroundStore = writable(0)
|
||||
|
||||
function createSimpleCharacter(char:character|groupChat){
|
||||
if((!char) || char.type === 'group'){
|
||||
|
||||
Reference in New Issue
Block a user