Skip to content

Commit 1d0cb0f

Browse files
committed
feat: bot replicate/waifu-diffusion
1 parent 745d645 commit 1d0cb0f

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/providers/replicate/handler.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@ import type { Message } from '@/types/message'
44

55
export const handlePrompt: Provider['handlePrompt'] = async(payload, signal?: AbortSignal) => {
66
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)
810
}
911

10-
const handleStableDiffusion = async(payload: HandlerPayload) => {
12+
const handleReplicateGenerate = async(modelVersion: string, payload: HandlerPayload) => {
1113
const prompt = payload.prompt
1214
const response = await fetchImageGeneration({
1315
token: payload.globalSettings.token as string,
1416
method: 'POST',
1517
body: {
16-
version: payload.globalSettings.version as string,
18+
version: modelVersion,
1719
input: {
1820
prompt,
1921
},

src/providers/replicate/index.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ const providerReplicate = () => {
1212
name: 'Replicate API token',
1313
type: 'api-key',
1414
},
15-
{
16-
key: 'version',
17-
name: 'Model Version',
18-
description: 'Version hash for Stable Diffusion.',
19-
type: 'input',
20-
default: 'db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf',
21-
},
2215
],
2316
bots: [
2417
{
@@ -27,6 +20,12 @@ const providerReplicate = () => {
2720
name: 'Stable Diffusion',
2821
settings: [],
2922
},
23+
{
24+
id: 'waifu-diffusion',
25+
type: 'image_generation',
26+
name: 'Waifu Diffusion',
27+
settings: [],
28+
},
3029
],
3130
supportCallMethod: 'backend',
3231
handlePrompt,

0 commit comments

Comments
 (0)