Merge branch 'kwaroran:main' into main
This commit is contained in:
@@ -1643,7 +1643,7 @@ export async function downloadRisuHub(id:string, arg:{
|
||||
msg: "Downloading..."
|
||||
})
|
||||
}
|
||||
const res = await fetch("https://realm.risuai.net/api/v1/download/png-v3/" + id + '?cors=true', {
|
||||
const res = await fetch("https://realm.risuai.net/api/v1/download/dynamic/" + id + '?cors=true', {
|
||||
headers: {
|
||||
"x-risu-api-version": "4"
|
||||
}
|
||||
@@ -1653,13 +1653,23 @@ export async function downloadRisuHub(id:string, arg:{
|
||||
return
|
||||
}
|
||||
|
||||
if(res.headers.get('content-type') === 'image/png'){
|
||||
if(res.headers.get('content-type') === 'image/png' || res.headers.get('content-type') === 'application/zip'){
|
||||
let db = getDatabase()
|
||||
await importCharacterProcess({
|
||||
name: 'realm.png',
|
||||
data: res.body,
|
||||
lightningRealmImport: db.lightningRealmImport
|
||||
})
|
||||
if(res.headers.get('content-type') === 'application/zip'){
|
||||
console.log('zip')
|
||||
await importCharacterProcess({
|
||||
name: 'realm.charx',
|
||||
data: new Uint8Array(await res.arrayBuffer()),
|
||||
lightningRealmImport: db.lightningRealmImport,
|
||||
})
|
||||
}
|
||||
else{
|
||||
await importCharacterProcess({
|
||||
name: 'realm.png',
|
||||
data: res.body,
|
||||
lightningRealmImport: db.lightningRealmImport,
|
||||
})
|
||||
}
|
||||
checkCharOrder()
|
||||
db = getDatabase()
|
||||
if(db.characters[db.characters.length-1] && (db.goCharacterOnImport || arg.forceRedirect)){
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Parameter } from "../process/request"
|
||||
import { getDatabase } from "../storage/database.svelte"
|
||||
|
||||
export enum LLMFlags{
|
||||
hasImageInput,
|
||||
@@ -979,11 +980,16 @@ for(let model of LLMModels){
|
||||
|
||||
export function getModelInfo(id: string): LLMModel{
|
||||
|
||||
const found:LLMModel = LLMModels.find(model => model.id === id)
|
||||
const db = getDatabase()
|
||||
const found:LLMModel = safeStructuredClone(LLMModels.find(model => model.id === id))
|
||||
|
||||
if(found){
|
||||
if(db.enableCustomFlags){
|
||||
found.flags = db.customFlags
|
||||
}
|
||||
|
||||
console.log('found', found)
|
||||
|
||||
if(found) return found
|
||||
return found
|
||||
}
|
||||
|
||||
if(id.startsWith('hf:::')){
|
||||
const withoutPrefix = id.replace('hf:::', '')
|
||||
|
||||
@@ -1760,16 +1760,19 @@ function trimLines(p1:string){
|
||||
}
|
||||
|
||||
function blockEndMatcher(p1:string,type:{type:blockMatch,type2?:string},matcherArg:matcherArg):string{
|
||||
const p1Trimed = p1.trim()
|
||||
switch(type.type){
|
||||
case 'pure':
|
||||
case 'parse-pure':
|
||||
case 'pure-display':
|
||||
case 'function':{
|
||||
return p1
|
||||
return p1Trimed
|
||||
}
|
||||
case 'parse':
|
||||
case 'each':{
|
||||
return trimLines(p1)
|
||||
return trimLines(p1Trimed)
|
||||
}
|
||||
case 'parse-pure':{
|
||||
return p1
|
||||
}
|
||||
default:{
|
||||
return ''
|
||||
@@ -1952,7 +1955,7 @@ export function risuChatParser(da:string, arg:{
|
||||
}
|
||||
blockNestType.delete(nested.length)
|
||||
const dat2 = nested.shift()
|
||||
const matchResult = blockEndMatcher(dat2.trim(), blockType, matcherObj)
|
||||
const matchResult = blockEndMatcher(dat2, blockType, matcherObj)
|
||||
if(blockType.type === 'each'){
|
||||
const subind = blockType.type2.lastIndexOf(' ')
|
||||
const sub = blockType.type2.substring(subind + 1)
|
||||
|
||||
@@ -1330,6 +1330,22 @@ export async function sendChat(chatProcessIndex = -1,arg:{
|
||||
})
|
||||
}
|
||||
|
||||
if(DBState.db.notification){
|
||||
try {
|
||||
const permission = await Notification.requestPermission()
|
||||
if(permission === 'granted'){
|
||||
const noti = new Notification('RisuAI', {
|
||||
body: result
|
||||
})
|
||||
noti.onclick = () => {
|
||||
window.focus()
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
chatProcessStage.set(4)
|
||||
|
||||
peerSync()
|
||||
|
||||
@@ -12,7 +12,7 @@ import { defaultColorScheme, type ColorScheme } from '../gui/colorscheme';
|
||||
import type { PromptItem, PromptSettings } from '../process/prompt';
|
||||
import type { OobaChatCompletionRequestParams } from '../model/ooba';
|
||||
|
||||
export let appVer = "141.0.0"
|
||||
export let appVer = "141.2.0"
|
||||
export let webAppSubVer = ''
|
||||
|
||||
|
||||
@@ -462,6 +462,8 @@ export function setDatabase(data:Database){
|
||||
translate: {},
|
||||
otherAx: {}
|
||||
}
|
||||
data.customFlags ??= []
|
||||
data.enableCustomFlags ??= false
|
||||
changeLanguage(data.language)
|
||||
setDatabaseLite(data)
|
||||
}
|
||||
@@ -852,6 +854,9 @@ export interface Database{
|
||||
translateBeforeHTMLFormatting:boolean
|
||||
autoTranslateCachedOnly:boolean
|
||||
lightningRealmImport:boolean
|
||||
notification: boolean
|
||||
customFlags: LLMFlags[]
|
||||
enableCustomFlags: boolean
|
||||
}
|
||||
|
||||
interface SeparateParameters{
|
||||
@@ -1171,6 +1176,8 @@ export interface botPreset{
|
||||
systemContentReplacement?: string
|
||||
systemRoleReplacement?: 'user'|'assistant'
|
||||
openAIPrediction?: string
|
||||
enableCustomFlags?: boolean
|
||||
customFlags?: LLMFlags[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1469,6 +1476,8 @@ export function saveCurrentPreset(){
|
||||
customAPIFormat: safeStructuredClone(db.customAPIFormat),
|
||||
systemContentReplacement: db.systemContentReplacement,
|
||||
systemRoleReplacement: db.systemRoleReplacement,
|
||||
customFlags: safeStructuredClone(db.customFlags),
|
||||
enableCustomFlags: db.enableCustomFlags,
|
||||
}
|
||||
db.botPresets = pres
|
||||
setDatabase(db)
|
||||
@@ -1574,6 +1583,8 @@ export function setPreset(db:Database, newPres: botPreset){
|
||||
db.customAPIFormat = safeStructuredClone(newPres.customAPIFormat) ?? LLMFormat.OpenAICompatible
|
||||
db.systemContentReplacement = newPres.systemContentReplacement ?? ''
|
||||
db.systemRoleReplacement = newPres.systemRoleReplacement ?? 'user'
|
||||
db.customFlags = safeStructuredClone(newPres.customFlags) ?? []
|
||||
db.enableCustomFlags = newPres.enableCustomFlags ?? false
|
||||
return db
|
||||
}
|
||||
|
||||
@@ -1584,7 +1595,7 @@ import type { RisuModule } from '../process/modules';
|
||||
import type { HypaV2Data } from '../process/memory/hypav2';
|
||||
import { decodeRPack, encodeRPack } from '../rpack/rpack_bg';
|
||||
import { DBState, selectedCharID } from '../stores.svelte';
|
||||
import { LLMFormat } from '../model/modellist';
|
||||
import { LLMFlags, LLMFormat } from '../model/modellist';
|
||||
import type { Parameter } from '../process/request';
|
||||
|
||||
export async function downloadPreset(id:number, type:'json'|'risupreset'|'return' = 'json'){
|
||||
|
||||
Reference in New Issue
Block a user