diff --git a/src/App.vue b/src/App.vue index 94894a7edc6ffe05b10d7acb4b06a550755d4e70..c3218aca1eec65c0a137272e31afaaf3f18a3fb7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -52,8 +52,8 @@ <div class="flex flex-row-reverse"> <t-image class="rounded-lg" v-if="config.user_img" :src="config.user_img" fit="cover" :style="{ width: '40px', height: '40px' }"></t-image> - <div class="bg-green-400 text-gray-700 p-4 mx-2 w-fit max-w-2xl 2xl:max-w-4xl rounded-lg cursor-pointer" @click="copyAsPrompt(item.message)"> - {{ item.message }} + <div class="bg-green-400 text-gray-700 p-4 mx-2 w-fit max-w-2xl 2xl:max-w-4xl rounded-lg cursor-pointer" @click="copyAsPrompt(item.message)" v-html="item.message"> + </div> </div> @@ -85,10 +85,18 @@ </div> </div> - <div class="w-full absolute bottom-0 bg-slate-100 h-22 py-2 px-2 rounded flex flex-col"> + <div class="w-full absolute bottom-0 bg-slate-100 h-22 py-2 px-2 rounded flex flex-col text-sm"> <div class="w-full h-10 flex"> <input v-model="prompt" class="flex-auto ring-0 outline-0 pl-2 bg-slate-200 h-10" v-on:keyup.enter="query" placeholder="æ示è¯" /> + + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" + @click="showMoreSetting=!showMoreSetting" + class="w-6 mx-2 ml-4 mt-2 h-6 flex-none text-cyan-800 font-bold hover:text-cyan-600 cursor-pointer"> + <path stroke-linecap="round" stroke-linejoin="round" d="M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z" /> + <path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /> + </svg> + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 mx-2 ml-4 mt-2 h-6 flex-none text-cyan-800 font-bold hover:text-cyan-600 cursor-pointer" @@ -96,9 +104,12 @@ <path stroke-linecap="round" stroke-linejoin="round" d="M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5" /> </svg> + + + </div> - <div class="w-full h-10 mt-2 pr-12 flex gap-2"> - <input v-model="prompt" class="flex-auto ring-0 outline-0 pl-2 bg-slate-200 h-10" v-on:keyup.enter="query" placeholder="逆å‘æ示è¯" /> + <div class="w-full h-10 mt-2 flex gap-2" v-if="showMoreSetting"> + <input v-model="negative_prompt" class="flex-auto ring-0 outline-0 pl-2 bg-slate-200 h-10" v-on:keyup.enter="query" placeholder="逆å‘æ示è¯" /> <div class="flex-none w-40 ring-0 outline-0 pl-2 h-10 flex justify-between"> <input v-model="width" class="ring-0 outline-0 pl-2 bg-slate-200 h-10 w-16" placeholder="width"/> <span class="h-10 leading-10">*</span> @@ -155,6 +166,7 @@ export default { user_img: "", robot_img: "", user_call_name: "xxx", + width: 512, // api_url: 'https://inscode-ide.node.inscode.run:8000/v1', // index_url: 'http://127.0.0.1:8000/search', // index_name: 'datasea', @@ -175,6 +187,9 @@ export default { height: 512, steps: 20, sampler: 'DPM++ SDE Karras', + showMoreSetting: false, + default_prompt: '1girl, (ulzzang-6500:0.7), kpop idol, yae miko, detached sleeves, bare shoulders, pink hair, long hair, cleavage,japanese clothes,breast,best quality, (painting:1.5), (hair ornament:1.35), jewelry, purple eyes, earrings, breasts, torii, cherry blossoms, lantern light, depth of field, detailed face, face focus, ribbon_trim, (looking at viewer:1.25), nontraditional miko, shiny skin, long sleeves, smile, thick lips, game cg, east asian architecture, (blurry background:1.2), sitting, upper body <lora:YaeMiko_Test:0.45>,<lora:mix4:0.5>', + negative_prompt: 'bright lantern, brightness, (nipples:1.2), pussy, EasyNegative, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans,extra fingers, fewer fingers, strange fingers, bad hand, bare thighs,hand,bad finger', } }, methods: { @@ -270,16 +285,23 @@ export default { "user": "AI", "message": '', img: null, viewMode: 'image' } const query = this.prompt + const negative_prompt = this.negative_prompt const _this = this const messages = this.message - messages.push({ "user": "User", "message": this.prompt }) + messages.push({ "user": "User", "message": 'prompt: <br/>' + this.prompt + (negative_prompt ? '<br/>' + 'negative_prompt: </br>' + negative_prompt : '') }) messages.push(currentMsg) this.loading = true - this.prompt = '' + // this.prompt = '' this.scrollBottom() - SDApi.draw(this.config, query).then(res => { + const config = JSON.parse(JSON.stringify(this.config)) + config.width = this.width + config.height = this.height + config.steps = this.steps + config.sampler = this.sampler + + SDApi.draw(config, query, negative_prompt).then(res => { _this.loading = false _this.saveHistory() diff --git a/src/js/sd.js b/src/js/sd.js index 2bbc8a1ef74679cd42a7614f42db784f9d31d713..64e4fa0e696db933d6cae2560087983ffbda5912 100644 --- a/src/js/sd.js +++ b/src/js/sd.js @@ -1,13 +1,13 @@ import axios from "axios"; export default { - draw (config, prompt) { + draw (config, prompt, negative_prompt) { return new Promise(function(resolve,rejcet){ const data = { prompt: prompt, steps: config?.steps??20, - negative_prompt: config?.negative_prompt??'nsfw bright lantern, brightness, (nipples:1.2), pussy, EasyNegative, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans,extra fingers, fewer fingers, strange fingers, bad hand, bare thighs,hand,bad finger', + negative_prompt: negative_prompt??'nsfw', width: config?.width??512, height: config?.height??512, cfg_scale: config?.cfg_scale??6,