Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41531898
AI绘图
提交
523fa757
A
AI绘图
项目概览
weixin_41531898
/
AI绘图
与 Fork 源项目一致
Fork自
冯丙见 / AI绘图
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
AI绘图
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
523fa757
编写于
7月 06, 2023
作者:
6
622aa39c1f9b166ab1a38c05
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Thu Jul 6 08:14:00 UTC 2023 inscode
上级
714e9e5a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
133 addition
and
12 deletion
+133
-12
src/App.vue
src/App.vue
+22
-12
src/js/storage.js
src/js/storage.js
+111
-0
未找到文件。
src/App.vue
浏览文件 @
523fa757
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
<t-image
class=
"rounded-lg"
v-if=
"config.robot_img"
:src=
"config.robot_img"
fit=
"cover"
<t-image
class=
"rounded-lg"
v-if=
"config.robot_img"
:src=
"config.robot_img"
fit=
"cover"
:style=
"
{ width: '40px', height: '40px' }">
</t-image>
:style=
"
{ width: '40px', height: '40px' }">
</t-image>
<div
class=
"bg-slate-50 text-gray-700 p-4 mx-2 w-fit max-w-2xl 2xl:max-w-4xl rounded-lg text-wrapper"
>
<div
class=
"bg-slate-50 text-gray-700 p-4 mx-2 w-fit max-w-2xl 2xl:max-w-4xl rounded-lg text-wrapper"
>
{{
item
.
img
}}
<template
v-if=
"item?.viewMode??'chat' === 'image'"
>
<template
v-if=
"item?.viewMode??'chat' === 'image'"
>
<img
v-if=
"item.img"
:src=
"item.img"
/>
<img
v-if=
"item.img"
:src=
"item.img"
/>
<img
v-else
src=
"/loading.gif"
class=
"max-w-[512px]"
/>
<img
v-else
src=
"/loading.gif"
class=
"max-w-[512px]"
/>
...
@@ -137,6 +137,7 @@
...
@@ -137,6 +137,7 @@
import
OpenAI
from
'
./js/openai.js
'
import
OpenAI
from
'
./js/openai.js
'
import
Config
from
'
./js/config.js
'
import
Config
from
'
./js/config.js
'
import
SDApi
from
'
./js/sd.js
'
import
SDApi
from
'
./js/sd.js
'
import
StorageApi
from
'
./js/storage.js
'
// import MarkdownItVue from 'markdown-it-vue'
// import MarkdownItVue from 'markdown-it-vue'
// import 'markdown-it-vue/dist/markdown-it-vue.css'
// import 'markdown-it-vue/dist/markdown-it-vue.css'
...
@@ -156,7 +157,7 @@ export default {
...
@@ -156,7 +157,7 @@ export default {
userAvatarList
:
[],
userAvatarList
:
[],
robotAvatarList
:
[],
robotAvatarList
:
[],
mode
:
'
draw
'
,
mode
:
'
draw
'
,
modeImage
:
'
chart-bubble
'
,
modeImage
:
'
image
'
,
// image chat chart-bubble
message
:
[
message
:
[
// {"user": "User", "message": "创建一个用户表,要求分区"},
// {"user": "User", "message": "创建一个用户表,要求分区"},
// {"user": "AI", "message": "在GaussDB数据库中创建一个带有分区的用户表可以使用以下语句:在GaussDB数据库中创建一个带有分区的用户表可以使用以下语句:在GaussDB数据库中创建一个带有分区的用户表可以使用以下语句:在GaussDB数据库中创建一个带有分区的用户表可以使用以下语句:"},
// {"user": "AI", "message": "在GaussDB数据库中创建一个带有分区的用户表可以使用以下语句:在GaussDB数据库中创建一个带有分区的用户表可以使用以下语句:在GaussDB数据库中创建一个带有分区的用户表可以使用以下语句:在GaussDB数据库中创建一个带有分区的用户表可以使用以下语句:"},
...
@@ -183,9 +184,13 @@ export default {
...
@@ -183,9 +184,13 @@ export default {
height
:
512
,
height
:
512
,
steps
:
20
,
steps
:
20
,
sampler
:
'
DPM++ SDE Karras
'
,
sampler
:
'
DPM++ SDE Karras
'
,
showMoreSetting
:
fals
e
,
showMoreSetting
:
tru
e
,
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>
'
,
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
'
,
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
'
,
history
:
{
name
:
'
ai
'
,
key
:
'
history
'
,
},
}
}
},
},
methods
:
{
methods
:
{
...
@@ -391,14 +396,17 @@ export default {
...
@@ -391,14 +396,17 @@ export default {
}
}
},
},
recoveryHistory
()
{
recoveryHistory
()
{
const
cacheKey
=
'
history_
'
+
this
.
id
const
cacheKey
=
this
.
history
.
key
const
data
=
localStorage
.
getItem
(
cacheKey
)
if
(
data
)
{
StorageApi
.
get
(
this
.
history
.
name
,
cacheKey
).
then
(
data
=>
{
this
.
message
=
JSON
.
parse
(
data
)
debugger
}
if
(
data
&&
data
.
data
)
{
this
.
message
=
JSON
.
parse
(
data
.
data
)
}
})
},
},
saveHistory
()
{
saveHistory
()
{
const
cacheKey
=
'
history_
'
+
this
.
id
const
cacheKey
=
this
.
history
.
key
if
(
this
.
message
.
length
>
this
.
maxHistory
)
{
if
(
this
.
message
.
length
>
this
.
maxHistory
)
{
const
tmpHistory
=
[]
const
tmpHistory
=
[]
const
start
=
this
.
message
.
length
-
this
.
maxHistory
const
start
=
this
.
message
.
length
-
this
.
maxHistory
...
@@ -406,9 +414,9 @@ export default {
...
@@ -406,9 +414,9 @@ export default {
for
(
let
id
=
start
;
id
<
end
;
id
++
)
{
for
(
let
id
=
start
;
id
<
end
;
id
++
)
{
tmpHistory
.
push
(
this
.
message
[
id
])
tmpHistory
.
push
(
this
.
message
[
id
])
}
}
localStorage
.
setItem
(
cacheKey
,
JSON
.
stringify
(
tmpHistory
))
StorageApi
.
set
(
this
.
history
.
name
,
cacheKey
,
JSON
.
stringify
(
tmpHistory
))
}
else
{
}
else
{
localStorage
.
setItem
(
cacheKey
,
JSON
.
stringify
(
this
.
message
))
StorageApi
.
set
(
this
.
history
.
name
,
cacheKey
,
JSON
.
stringify
(
this
.
message
))
}
}
},
},
...
@@ -445,7 +453,9 @@ export default {
...
@@ -445,7 +453,9 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
id
=
this
.
$route
?.
params
?.
id
this
.
id
=
this
.
$route
?.
params
?.
id
this
.
recoveryHistory
()
StorageApi
.
init
(
this
.
history
.
name
).
then
(
res
=>
{
this
.
recoveryHistory
()
})
this
.
getAppInfo
()
this
.
getAppInfo
()
// this.getAvatar()
// this.getAvatar()
if
(
this
.
mode
===
'
draw
'
)
{
if
(
this
.
mode
===
'
draw
'
)
{
...
...
src/js/storage.js
0 → 100644
浏览文件 @
523fa757
let
db
=
null
const
defaultTableName
=
'
history
'
export
default
{
init
(
tableName
=
defaultTableName
)
{
let
request
=
window
.
indexedDB
.
open
(
'
ai-draw
'
,
'
1
'
)
return
new
Promise
((
resolve
,
reject
)
=>
{
// 数据库操作过程中出错,则错误回调被触发
request
.
onerror
=
(
event
)
=>
{
console
.
log
(
"
db init报错
"
+
event
)
reject
()
}
request
.
onsuccess
=
(
event
)
=>
{
db
=
event
.
target
.
result
console
.
log
(
"
db init成功
"
)
resolve
()
}
request
.
onupgradeneeded
=
(
event
)
=>
{
db
=
event
.
target
.
result
let
objectStore
=
db
.
createObjectStore
(
tableName
,
{
keyPath
:
'
id
'
})
objectStore
.
createIndex
(
'
key
'
,
'
key
'
,
{
unique
:
true
})
console
.
log
(
"
db onupgradeneeded 成功
"
)
resolve
()
}
})
},
isConnected
(
tableName
=
defaultTableName
){
return
db
!=
null
},
set
(
tableName
=
defaultTableName
,
key
,
val
,
id
=
100
){
let
request
=
db
.
transaction
(
tableName
,
'
readwrite
'
)
.
objectStore
(
tableName
)
.
add
({
id
:
id
,
key
:
key
,
data
:
val
})
return
new
Promise
((
resolve
,
reject
)
=>
{
request
.
onsuccess
=
(
event
)
=>
{
console
.
info
(
'
添加成功
'
,
event
)
resolve
(
event
)
}
request
.
onerror
=
(
event
)
=>
{
console
.
info
(
'
添加失败
'
)
reject
(
event
)
}
})
},
getAll
(
tableName
=
defaultTableName
){
let
request
=
db
.
transaction
(
tableName
,
'
readwrite
'
)
.
objectStore
(
tableName
)
.
index
(
'
key
'
)
.
getAll
()
console
.
info
(
"
开水获取全部
"
)
return
new
Promise
((
resolve
,
reject
)
=>
{
request
.
onsuccess
=
(
event
)
=>
{
console
.
info
(
'
获取成功
'
)
resolve
(
request
.
result
)
}
request
.
onerror
=
(
event
)
=>
{
console
.
info
(
'
获取失败
'
)
reject
(
event
)
}
})
},
get
(
tableName
=
defaultTableName
,
key
){
let
request
=
db
.
transaction
(
tableName
,
'
readwrite
'
)
.
objectStore
(
tableName
)
.
index
(
'
key
'
)
.
get
(
key
)
console
.
info
(
"
获取
"
)
return
new
Promise
((
resolve
,
reject
)
=>
{
request
.
onsuccess
=
(
event
)
=>
{
console
.
info
(
'
获取成功
'
)
resolve
(
request
.
result
)
}
request
.
onerror
=
(
event
)
=>
{
console
.
info
(
'
获取失败
'
)
reject
(
event
)
}
})
},
del
(
tableName
=
defaultTableName
,
id
=
100
){
let
request
=
db
.
transaction
(
tableName
,
'
readwrite
'
)
.
objectStore
(
tableName
)
.
delete
(
id
)
console
.
info
(
"
开始删除
"
)
return
new
Promise
((
resolve
,
reject
)
=>
{
request
.
onsuccess
=
(
event
)
=>
{
console
.
info
(
'
删除成功
'
)
resolve
(
request
.
result
)
}
request
.
onerror
=
(
event
)
=>
{
console
.
info
(
'
删除失败
'
)
reject
(
event
)
}
})
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录