File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -4,16 +4,18 @@ import type { Message } from '@/types/message'
4
4
5
5
export const handlePrompt : Provider [ 'handlePrompt' ] = async ( payload , signal ?: AbortSignal ) => {
6
6
if ( payload . botId === 'stable-diffusion' )
7
- return handleStableDiffusion ( payload )
7
+ return handleReplicateGenerate ( 'db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf' , payload )
8
+ if ( payload . botId === 'waifu-diffusion' )
9
+ return handleReplicateGenerate ( '25d2f75ecda0c0bed34c806b7b70319a53a1bccad3ade1a7496524f013f48983' , payload )
8
10
}
9
11
10
- const handleStableDiffusion = async ( payload : HandlerPayload ) => {
12
+ const handleReplicateGenerate = async ( modelVersion : string , payload : HandlerPayload ) => {
11
13
const prompt = payload . prompt
12
14
const response = await fetchImageGeneration ( {
13
15
token : payload . globalSettings . token as string ,
14
16
method : 'POST' ,
15
17
body : {
16
- version : payload . globalSettings . version as string ,
18
+ version : modelVersion ,
17
19
input : {
18
20
prompt,
19
21
} ,
Original file line number Diff line number Diff line change @@ -12,13 +12,6 @@ const providerReplicate = () => {
12
12
name : 'Replicate API token' ,
13
13
type : 'api-key' ,
14
14
} ,
15
- {
16
- key : 'version' ,
17
- name : 'Model Version' ,
18
- description : 'Version hash for Stable Diffusion.' ,
19
- type : 'input' ,
20
- default : 'db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf' ,
21
- } ,
22
15
] ,
23
16
bots : [
24
17
{
@@ -27,6 +20,12 @@ const providerReplicate = () => {
27
20
name : 'Stable Diffusion' ,
28
21
settings : [ ] ,
29
22
} ,
23
+ {
24
+ id : 'waifu-diffusion' ,
25
+ type : 'image_generation' ,
26
+ name : 'Waifu Diffusion' ,
27
+ settings : [ ] ,
28
+ } ,
30
29
] ,
31
30
supportCallMethod : 'backend' ,
32
31
handlePrompt,
You can’t perform that action at this time.
0 commit comments