forked from erictik/midjourney-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request erictik#6 from erictik:queue
Queue
- Loading branch information
Showing
18 changed files
with
862 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,9 @@ on: | |
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'main' | ||
- "main" | ||
paths: | ||
- '**.ts' | ||
- "**.ts" | ||
jobs: | ||
publish-gpr: | ||
runs-on: ubuntu-latest | ||
|
@@ -17,8 +17,8 @@ jobs: | |
- uses: actions/checkout@v3 | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: '16.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
node-version: "16.x" | ||
registry-url: "https://registry.npmjs.org" | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
- run: yarn install | ||
|
@@ -29,4 +29,4 @@ jobs: | |
uses: softprops/[email protected] | ||
with: | ||
tag_name: ${{ env.APPVERSION }} | ||
target_commitish: ${{ github.sha }} | ||
target_commitish: ${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
libs | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
import 'dotenv/config' | ||
import { Midjourney } from '../src'; | ||
import "dotenv/config"; | ||
import { Midjourney } from "../src"; | ||
/** | ||
* | ||
* | ||
* a simple example of how to use the imagine command | ||
* ``` | ||
* npx tsx example/imagine.ts | ||
* ``` | ||
*/ | ||
async function main() { | ||
const client = new Midjourney(<string>process.env.SERVER_ID, <string>process.env.CHANNEL_ID, <string>process.env.SALAI_TOKEN, true) | ||
const msg = await client.Imagine("A little pink elephant", (uri: string) => { | ||
console.log("loading", uri) | ||
}) | ||
console.log({ msg }) | ||
const client = new Midjourney( | ||
<string>process.env.SERVER_ID, | ||
<string>process.env.CHANNEL_ID, | ||
<string>process.env.SALAI_TOKEN, | ||
true | ||
); | ||
const msg = await client.Imagine("A little pink elephant", (uri: string) => { | ||
console.log("loading", uri); | ||
}); | ||
console.log({ msg }); | ||
} | ||
main().catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
console.error(err); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,37 @@ | ||
import 'dotenv/config' | ||
import { Midjourney } from '../src'; | ||
import "dotenv/config"; | ||
import { Midjourney } from "../src"; | ||
/** | ||
* | ||
* | ||
* a simple example of how to use the Upscale command | ||
* ``` | ||
* npx tsx example/upscale.ts | ||
* ``` | ||
*/ | ||
async function main() { | ||
const client = new Midjourney(<string>process.env.SERVER_ID, <string>process.env.CHANNEL_ID, <string>process.env.SALAI_TOKEN, true) | ||
const msg = await client.Imagine("a cool cat, blue ears, red hat") | ||
console.log({ msg }) | ||
if (!msg) { | ||
console.log("no message") | ||
return | ||
const client = new Midjourney( | ||
<string>process.env.SERVER_ID, | ||
<string>process.env.CHANNEL_ID, | ||
<string>process.env.SALAI_TOKEN, | ||
true | ||
); | ||
const msg = await client.Imagine("a cool cat, blue ears, red hat"); | ||
console.log({ msg }); | ||
if (!msg) { | ||
console.log("no message"); | ||
return; | ||
} | ||
const msg2 = await client.Upscale( | ||
msg.content, | ||
2, | ||
msg.id, | ||
msg.hash, | ||
(uri: string) => { | ||
console.log("loading", uri); | ||
} | ||
const msg2 = await client.Upscale(msg.content, 2, msg.id, msg.hash, (uri: string) => { | ||
console.log("loading", uri) | ||
}) | ||
console.log({ msg2 }) | ||
); | ||
console.log({ msg2 }); | ||
} | ||
main().catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
console.error(err); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,37 @@ | ||
import 'dotenv/config' | ||
import { Midjourney } from '../src'; | ||
import "dotenv/config"; | ||
import { Midjourney } from "../src"; | ||
/** | ||
* | ||
* | ||
* a simple example of how to use the Variation command | ||
* ``` | ||
* npx tsx example/variation.ts | ||
* ``` | ||
*/ | ||
async function main() { | ||
const client = new Midjourney(<string>process.env.SERVER_ID, <string>process.env.CHANNEL_ID,<string>process.env.SALAI_TOKEN,true) | ||
const msg = await client.Imagine("a dog, blue ears, and a red nose") | ||
console.log({msg}) | ||
if (!msg) { | ||
console.log("no message") | ||
return | ||
const client = new Midjourney( | ||
<string>process.env.SERVER_ID, | ||
<string>process.env.CHANNEL_ID, | ||
<string>process.env.SALAI_TOKEN, | ||
true | ||
); | ||
const msg = await client.Imagine("a dog, blue ears, and a red nose"); | ||
console.log({ msg }); | ||
if (!msg) { | ||
console.log("no message"); | ||
return; | ||
} | ||
const msg2 = await client.Variation( | ||
msg.content, | ||
2, | ||
msg.id, | ||
msg.hash, | ||
(uri: string) => { | ||
console.log("loading", uri); | ||
} | ||
const msg2 = await client.Variation(msg.content,2,msg.id,msg.hash,(uri:string)=>{ | ||
console.log("loading",uri) | ||
}) | ||
console.log({msg2}) | ||
); | ||
console.log({ msg2 }); | ||
} | ||
main().catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
console.error(err); | ||
process.exit(1); | ||
}); |
Oops, something went wrong.