Merge branch 'kwaroran:main' into main
This commit is contained in:
@@ -8,7 +8,7 @@ android {
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 2
|
||||
versionName "114.1.1"
|
||||
versionName "114.2.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
aaptOptions {
|
||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 2,
|
||||
"versionName": "114.1.1",
|
||||
"versionName": "114.2.0",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
},
|
||||
"package": {
|
||||
"productName": "RisuAI",
|
||||
"version": "114.1.1"
|
||||
"version": "114.2.0"
|
||||
},
|
||||
"tauri": {
|
||||
"allowlist": {
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
<OptionInput value="webui" >Stable Diffusion WebUI</OptionInput>
|
||||
<OptionInput value="novelai" >Novel AI</OptionInput>
|
||||
<OptionInput value="dalle" >Dall-E</OptionInput>
|
||||
<OptionInput value="stability" >Stability API</OptionInput>
|
||||
</SelectInput>
|
||||
|
||||
{#if $DataBase.sdProvider === 'webui'}
|
||||
@@ -205,6 +206,43 @@
|
||||
</SelectInput>
|
||||
|
||||
{/if}
|
||||
|
||||
{#if $DataBase.sdProvider === 'stability'}
|
||||
<span class="text-textcolor">Stability API Key</span>
|
||||
<TextInput size="sm" marginBottom placeholder="..." bind:value={$DataBase.stabilityKey}/>
|
||||
|
||||
<span class="text-textcolor">Stability Model</span>
|
||||
<SelectInput className="mt-2 mb-4" bind:value={$DataBase.stabilityModel}>
|
||||
<OptionInput value="ultra" >SD Ultra</OptionInput>
|
||||
<OptionInput value="core" >SD Core</OptionInput>
|
||||
<OptionInput value="sd3-large" >SD3 Large</OptionInput>
|
||||
<OptionInput value="sd3-medium" >SD3 Medium</OptionInput>
|
||||
</SelectInput>
|
||||
|
||||
{#if $DataBase.stabilityModel === 'core'}
|
||||
<span class="text-textcolor">SD Core Style</span>
|
||||
<SelectInput className="mt-2 mb-4" bind:value={$DataBase.stabllityStyle}>
|
||||
<OptionInput value="" >Unspecified</OptionInput>
|
||||
<OptionInput value="3d-model" >3D Model</OptionInput>
|
||||
<OptionInput value="analog-film" >Analog Film</OptionInput>
|
||||
<OptionInput value="anime" >Anime</OptionInput>
|
||||
<OptionInput value="cinematic" >Cinematic</OptionInput>
|
||||
<OptionInput value="comic-book" >Comic Book</OptionInput>
|
||||
<OptionInput value="digital-art" >Digital Art</OptionInput>
|
||||
<OptionInput value="enhance" >Enhance</OptionInput>
|
||||
<OptionInput value="fantasy-art" >Fantasy Art</OptionInput>
|
||||
<OptionInput value="isometric" >Isometric</OptionInput>
|
||||
<OptionInput value="line-art" >Line Art</OptionInput>
|
||||
<OptionInput value="low-poly" >Low Poly</OptionInput>
|
||||
<OptionInput value="modeling-compound" >Modeling Compound</OptionInput>
|
||||
<OptionInput value="neon-punk" >Neon Punk</OptionInput>
|
||||
<OptionInput value="origami" >Origami</OptionInput>
|
||||
<OptionInput value="photographic" >Photographic</OptionInput>
|
||||
<OptionInput value="pixel-art" >Pixel Art</OptionInput>
|
||||
<OptionInput value="tile-texture" >Tile Texture</OptionInput>
|
||||
</SelectInput>
|
||||
{/if}
|
||||
{/if}
|
||||
</Arcodion>
|
||||
|
||||
<Arcodion name="TTS" styled>
|
||||
|
||||
@@ -56,6 +56,7 @@ export async function stableDiff(currentChar:character,prompt:string){
|
||||
|
||||
export async function generateAIImage(genPrompt:string, currentChar:character, neg:string, returnSdData:string):Promise<string|false>{
|
||||
const db = get(DataBase)
|
||||
console.log(db.sdProvider)
|
||||
if(db.sdProvider === 'webui'){
|
||||
|
||||
|
||||
@@ -361,6 +362,57 @@ export async function generateAIImage(genPrompt:string, currentChar:character, n
|
||||
return false
|
||||
}
|
||||
return returnSdData
|
||||
}
|
||||
if(db.sdProvider === 'stability'){
|
||||
const formData = new FormData()
|
||||
const model = db.stabilityModel
|
||||
formData.append('prompt', genPrompt)
|
||||
if(model !== 'core' && model !== 'ultra'){
|
||||
formData.append('negative_prompt', neg)
|
||||
formData.append('model', model)
|
||||
}
|
||||
if(model === 'core'){
|
||||
if(db.stabllityStyle){
|
||||
formData.append('style_preset', db.stabllityStyle)
|
||||
}
|
||||
}
|
||||
if(model === 'ultra'){
|
||||
formData.append('negative_prompt', neg)
|
||||
}
|
||||
|
||||
const uri = model === 'core' ? 'core' : model === 'ultra' ? 'ultra' : 'sd3'
|
||||
const da = await fetch("https://api.stability.ai/v2beta/stable-image/generate/" + uri, {
|
||||
body: formData,
|
||||
headers:{
|
||||
"authorization": "Bearer " + db.stabilityKey,
|
||||
"accept": "image/*"
|
||||
},
|
||||
method: 'POST'
|
||||
})
|
||||
|
||||
const res = await da.arrayBuffer()
|
||||
if(!da.ok){
|
||||
alertError(Buffer.from(res).toString())
|
||||
return false
|
||||
}
|
||||
|
||||
if((da.headers["content-type"] ?? "").startsWith('application/json')){
|
||||
alertError(Buffer.from(res).toString())
|
||||
return false
|
||||
}
|
||||
|
||||
if(returnSdData === 'inlay'){
|
||||
return `data:image/png;base64,${Buffer.from(res).toString('base64')}`
|
||||
}
|
||||
|
||||
let charemotions = get(CharEmotion)
|
||||
const img = `data:image/png;base64,${Buffer.from(res).toString('base64')}`
|
||||
const emos:[string, string,number][] = [[img, img, Date.now()]]
|
||||
charemotions[currentChar.chaId] = emos
|
||||
CharEmotion.set(charemotions)
|
||||
return returnSdData
|
||||
|
||||
|
||||
}
|
||||
return ''
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import type { OobaChatCompletionRequestParams } from '../model/ooba';
|
||||
|
||||
export const DataBase = writable({} as any as Database)
|
||||
export const loadedStore = writable(false)
|
||||
export let appVer = "114.1.1"
|
||||
export let appVer = "114.2.0"
|
||||
export let webAppSubVer = ''
|
||||
|
||||
export function setDatabase(data:Database){
|
||||
@@ -416,6 +416,8 @@ export function setDatabase(data:Database){
|
||||
data.font ??= 'default'
|
||||
data.customFont ??= ''
|
||||
data.lineHeight ??= 1.25
|
||||
data.stabilityModel ??= 'sd3-large'
|
||||
data.stabllityStyle ??= ''
|
||||
changeLanguage(data.language)
|
||||
DataBase.set(data)
|
||||
}
|
||||
@@ -686,6 +688,9 @@ export interface Database{
|
||||
font: string
|
||||
customFont: string
|
||||
lineHeight: number
|
||||
stabilityModel: string
|
||||
stabilityKey: string
|
||||
stabllityStyle: string
|
||||
}
|
||||
|
||||
export interface customscript{
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":"114.1.1"}
|
||||
{"version":"114.2.0"}
|
||||
Reference in New Issue
Block a user