jbilcke-hf HF staff commited on
Commit
9052a89
β€’
1 Parent(s): 4f8f050

let's use Zephyr 7b for storytelling

Browse files
.env CHANGED
@@ -63,13 +63,14 @@ RENDERING_OPENAI_API_MODEL="dall-e-3"
63
 
64
  # If you decided to use OpenAI for the LLM engine
65
  LLM_OPENAI_API_BASE_URL="https://api.openai.com/v1"
66
- LLM_OPENAI_API_MODEL="gpt-3.5-turbo"
67
 
68
  # If you decided to use a private Hugging Face Inference Endpoint for the LLM engine
69
  LLM_HF_INFERENCE_ENDPOINT_URL=""
70
 
71
  # If you decided to use a Hugging Face Inference API model for the LLM engine
72
- LLM_HF_INFERENCE_API_MODEL="meta-llama/Llama-2-70b-chat-hf"
 
73
 
74
  # ----------- COMMUNITY SHARING (OPTIONAL) -----------
75
  # You don't need those community sharing options to run the AI Comic Factory
 
63
 
64
  # If you decided to use OpenAI for the LLM engine
65
  LLM_OPENAI_API_BASE_URL="https://api.openai.com/v1"
66
+ LLM_OPENAI_API_MODEL="gpt-4"
67
 
68
  # If you decided to use a private Hugging Face Inference Endpoint for the LLM engine
69
  LLM_HF_INFERENCE_ENDPOINT_URL=""
70
 
71
  # If you decided to use a Hugging Face Inference API model for the LLM engine
72
+ # LLM_HF_INFERENCE_API_MODEL="meta-llama/Llama-2-70b-chat-hf"
73
+ LLM_HF_INFERENCE_API_MODEL="HuggingFaceH4/zephyr-7b-beta"
74
 
75
  # ----------- COMMUNITY SHARING (OPTIONAL) -----------
76
  # You don't need those community sharing options to run the AI Comic Factory
package-lock.json CHANGED
@@ -43,7 +43,7 @@
43
  "konva": "^9.2.2",
44
  "lucide-react": "^0.260.0",
45
  "next": "13.4.10",
46
- "openai": "^4.16.1",
47
  "pick": "^0.0.1",
48
  "postcss": "8.4.26",
49
  "react": "18.2.0",
@@ -192,9 +192,9 @@
192
  }
193
  },
194
  "node_modules/@floating-ui/react-dom": {
195
- "version": "2.0.2",
196
- "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.2.tgz",
197
- "integrity": "sha512-5qhlDvjaLmAst/rKb3VdlCinwTF4EYMiVxuuc/HVUjs46W0zgtbMmAZ1UTsDrRTxRmUEzl92mOtWbeeXL26lSQ==",
198
  "dependencies": {
199
  "@floating-ui/dom": "^1.5.1"
200
  },
@@ -1651,23 +1651,23 @@
1651
  "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw=="
1652
  },
1653
  "node_modules/@types/node-fetch": {
1654
- "version": "2.6.8",
1655
- "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.8.tgz",
1656
- "integrity": "sha512-nnH5lV9QCMPsbEVdTb5Y+F3GQxLSw1xQgIydrb2gSfEavRPs50FnMr+KUaa+LoPSqibm2N+ZZxH7lavZlAT4GA==",
1657
  "dependencies": {
1658
  "@types/node": "*",
1659
  "form-data": "^4.0.0"
1660
  }
1661
  },
1662
  "node_modules/@types/prop-types": {
1663
- "version": "15.7.9",
1664
- "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.9.tgz",
1665
- "integrity": "sha512-n1yyPsugYNSmHgxDFjicaI2+gCNjsBck8UX9kuofAKlc0h1bL+20oSF72KeNaW2DUlesbEVCFgyV2dPGTiY42g=="
1666
  },
1667
  "node_modules/@types/qs": {
1668
- "version": "6.9.9",
1669
- "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.9.tgz",
1670
- "integrity": "sha512-wYLxw35euwqGvTDx6zfY1vokBFnsK0HNrzc6xNHchxfO2hpuRg74GbkEW7e3sSmPvj0TjCDT1VCa6OtHXnubsg==",
1671
  "dev": true
1672
  },
1673
  "node_modules/@types/react": {
@@ -1689,17 +1689,17 @@
1689
  }
1690
  },
1691
  "node_modules/@types/react-reconciler": {
1692
- "version": "0.28.7",
1693
- "resolved": "https://registry.npmjs.org/@types/react-reconciler/-/react-reconciler-0.28.7.tgz",
1694
- "integrity": "sha512-sNYVByOrgx0a7vX4v3KUMqUA2Iaxc4SozXdUUFxcgUXUMlIUQMgHJRlp7ig42180gknti8DRHleC7Ru4aLlyBQ==",
1695
  "dependencies": {
1696
  "@types/react": "*"
1697
  }
1698
  },
1699
  "node_modules/@types/react-virtualized": {
1700
- "version": "9.21.26",
1701
- "resolved": "https://registry.npmjs.org/@types/react-virtualized/-/react-virtualized-9.21.26.tgz",
1702
- "integrity": "sha512-fUpUyQqF8PTrFmBZzE9PcdtPwL8xgqUdXmtrYadNgFDYwbKBl3Lz0khp+tZ7dyKIHUVDO9NDlgQx8q1+LIUk+A==",
1703
  "dev": true,
1704
  "dependencies": {
1705
  "@types/prop-types": "*",
@@ -1707,20 +1707,20 @@
1707
  }
1708
  },
1709
  "node_modules/@types/sbd": {
1710
- "version": "1.0.4",
1711
- "resolved": "https://registry.npmjs.org/@types/sbd/-/sbd-1.0.4.tgz",
1712
- "integrity": "sha512-j/1NO9SzpSyh2dnQjcV6VVWQvXyoNFX9nniZs3AlqQEJ7LF0Kq2Go/b6N+BrdnC7P93gtKmZZqMHOD8L6lg0fg==",
1713
  "dev": true
1714
  },
1715
  "node_modules/@types/scheduler": {
1716
- "version": "0.16.5",
1717
- "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.5.tgz",
1718
- "integrity": "sha512-s/FPdYRmZR8SjLWGMCuax7r3qCWQw9QKHzXVukAuuIJkXkDRwp+Pu5LMIVFi0Fxbav35WURicYr8u1QsoybnQw=="
1719
  },
1720
  "node_modules/@types/uuid": {
1721
- "version": "9.0.6",
1722
- "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.6.tgz",
1723
- "integrity": "sha512-BT2Krtx4xaO6iwzwMFUYvWBWkV2pr37zD68Vmp1CDV196MzczBRxuEpD6Pr395HAgebC/co7hOphs53r8V7jew=="
1724
  },
1725
  "node_modules/@typescript-eslint/parser": {
1726
  "version": "5.62.0",
@@ -2324,9 +2324,9 @@
2324
  }
2325
  },
2326
  "node_modules/caniuse-lite": {
2327
- "version": "1.0.30001561",
2328
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001561.tgz",
2329
- "integrity": "sha512-NTt0DNoKe958Q0BE0j0c1V9jbUzhBxHIEJy7asmGrpE0yG63KTV7PLHPnK2E1O9RsQrQ081I3NLuXGS6zht3cw==",
2330
  "funding": [
2331
  {
2332
  "type": "opencollective",
@@ -2770,9 +2770,9 @@
2770
  }
2771
  },
2772
  "node_modules/cookies-next/node_modules/@types/node": {
2773
- "version": "16.18.60",
2774
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.60.tgz",
2775
- "integrity": "sha512-ZUGPWx5vKfN+G2/yN7pcSNLkIkXEvlwNaJEd4e0ppX7W2S8XAkdc/37hM4OUNJB9sa0p12AOvGvxL4JCPiz9DA=="
2776
  },
2777
  "node_modules/create-require": {
2778
  "version": "1.1.1",
@@ -3054,9 +3054,9 @@
3054
  }
3055
  },
3056
  "node_modules/electron-to-chromium": {
3057
- "version": "1.4.577",
3058
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.577.tgz",
3059
- "integrity": "sha512-/5xHPH6f00SxhHw6052r+5S1xO7gHNc89hV7tqlvnStvKbSrDqc/u6AlwPvVWWNj+s4/KL6T6y8ih+nOY0qYNA=="
3060
  },
3061
  "node_modules/emoji-regex": {
3062
  "version": "9.2.2",
@@ -3724,16 +3724,16 @@
3724
  }
3725
  },
3726
  "node_modules/flat-cache": {
3727
- "version": "3.1.1",
3728
- "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz",
3729
- "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==",
3730
  "dependencies": {
3731
  "flatted": "^3.2.9",
3732
  "keyv": "^4.5.3",
3733
  "rimraf": "^3.0.2"
3734
  },
3735
  "engines": {
3736
- "node": ">=12.0.0"
3737
  }
3738
  },
3739
  "node_modules/flatted": {
@@ -5160,9 +5160,9 @@
5160
  }
5161
  },
5162
  "node_modules/openai": {
5163
- "version": "4.16.1",
5164
- "resolved": "https://registry.npmjs.org/openai/-/openai-4.16.1.tgz",
5165
- "integrity": "sha512-Gr+uqUN1ICSk6VhrX64E+zL7skjI1TgPr/XUN+ZQuNLLOvx15+XZulx/lSW4wFEAQzgjBDlMBbBeikguGIjiMg==",
5166
  "dependencies": {
5167
  "@types/node": "^18.11.18",
5168
  "@types/node-fetch": "^2.6.4",
@@ -5179,9 +5179,9 @@
5179
  }
5180
  },
5181
  "node_modules/openai/node_modules/@types/node": {
5182
- "version": "18.18.8",
5183
- "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.8.tgz",
5184
- "integrity": "sha512-OLGBaaK5V3VRBS1bAkMVP2/W9B+H8meUfl866OrMNQqt7wDgdpWPp5o6gmIc9pB+lIQHSq4ZL8ypeH1vPxcPaQ==",
5185
  "dependencies": {
5186
  "undici-types": "~5.26.4"
5187
  }
@@ -5644,9 +5644,9 @@
5644
  }
5645
  },
5646
  "node_modules/react-icons": {
5647
- "version": "4.11.0",
5648
- "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.11.0.tgz",
5649
- "integrity": "sha512-V+4khzYcE5EBk/BvcuYRq6V/osf11ODUM2J8hg2FDSswRrGvqiYUYPRy4OdrWaQOBj4NcpJfmHZLNaD+VH0TyA==",
5650
  "peerDependencies": {
5651
  "react": "*"
5652
  }
@@ -6191,9 +6191,9 @@
6191
  }
6192
  },
6193
  "node_modules/streamx": {
6194
- "version": "2.15.2",
6195
- "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.2.tgz",
6196
- "integrity": "sha512-b62pAV/aeMjUoRN2C/9F0n+G8AfcJjNC0zw/ZmOHeFsIe4m4GzjVW9m6VHXVjk536NbdU9JRwKMJRfkc+zUFTg==",
6197
  "dependencies": {
6198
  "fast-fifo": "^1.1.0",
6199
  "queue-tick": "^1.0.1"
 
43
  "konva": "^9.2.2",
44
  "lucide-react": "^0.260.0",
45
  "next": "13.4.10",
46
+ "openai": "^4.17.5",
47
  "pick": "^0.0.1",
48
  "postcss": "8.4.26",
49
  "react": "18.2.0",
 
192
  }
193
  },
194
  "node_modules/@floating-ui/react-dom": {
195
+ "version": "2.0.4",
196
+ "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.4.tgz",
197
+ "integrity": "sha512-CF8k2rgKeh/49UrnIBs4BdxPUV6vize/Db1d/YbCLyp9GiVZ0BEwf5AiDSxJRCr6yOkGqTFHtmrULxkEfYZ7dQ==",
198
  "dependencies": {
199
  "@floating-ui/dom": "^1.5.1"
200
  },
 
1651
  "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw=="
1652
  },
1653
  "node_modules/@types/node-fetch": {
1654
+ "version": "2.6.9",
1655
+ "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.9.tgz",
1656
+ "integrity": "sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA==",
1657
  "dependencies": {
1658
  "@types/node": "*",
1659
  "form-data": "^4.0.0"
1660
  }
1661
  },
1662
  "node_modules/@types/prop-types": {
1663
+ "version": "15.7.10",
1664
+ "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.10.tgz",
1665
+ "integrity": "sha512-mxSnDQxPqsZxmeShFH+uwQ4kO4gcJcGahjjMFeLbKE95IAZiiZyiEepGZjtXJ7hN/yfu0bu9xN2ajcU0JcxX6A=="
1666
  },
1667
  "node_modules/@types/qs": {
1668
+ "version": "6.9.10",
1669
+ "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.10.tgz",
1670
+ "integrity": "sha512-3Gnx08Ns1sEoCrWssEgTSJs/rsT2vhGP+Ja9cnnk9k4ALxinORlQneLXFeFKOTJMOeZUFD1s7w+w2AphTpvzZw==",
1671
  "dev": true
1672
  },
1673
  "node_modules/@types/react": {
 
1689
  }
1690
  },
1691
  "node_modules/@types/react-reconciler": {
1692
+ "version": "0.28.8",
1693
+ "resolved": "https://registry.npmjs.org/@types/react-reconciler/-/react-reconciler-0.28.8.tgz",
1694
+ "integrity": "sha512-SN9c4kxXZonFhbX4hJrZy37yw9e7EIxcpHCxQv5JUS18wDE5ovkQKlqQEkufdJCCMfuI9BnjUJvhYeJ9x5Ra7g==",
1695
  "dependencies": {
1696
  "@types/react": "*"
1697
  }
1698
  },
1699
  "node_modules/@types/react-virtualized": {
1700
+ "version": "9.21.27",
1701
+ "resolved": "https://registry.npmjs.org/@types/react-virtualized/-/react-virtualized-9.21.27.tgz",
1702
+ "integrity": "sha512-DVAmqFXw4vKXLYHBMJKKt8+0t+O550uV2KT81aXRSztj7ieBSxIXL1X1cupwReb3Oux1RUfvmhEcRB2Jr6Z0Yw==",
1703
  "dev": true,
1704
  "dependencies": {
1705
  "@types/prop-types": "*",
 
1707
  }
1708
  },
1709
  "node_modules/@types/sbd": {
1710
+ "version": "1.0.5",
1711
+ "resolved": "https://registry.npmjs.org/@types/sbd/-/sbd-1.0.5.tgz",
1712
+ "integrity": "sha512-60PxBBWhg0C3yb5bTP+wwWYGTKMcuB0S6mTEa1sedMC79tYY0Ei7YjU4qsWzGn++lWscLQde16SnElJrf5/aTw==",
1713
  "dev": true
1714
  },
1715
  "node_modules/@types/scheduler": {
1716
+ "version": "0.16.6",
1717
+ "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.6.tgz",
1718
+ "integrity": "sha512-Vlktnchmkylvc9SnwwwozTv04L/e1NykF5vgoQ0XTmI8DD+wxfjQuHuvHS3p0r2jz2x2ghPs2h1FVeDirIteWA=="
1719
  },
1720
  "node_modules/@types/uuid": {
1721
+ "version": "9.0.7",
1722
+ "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.7.tgz",
1723
+ "integrity": "sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g=="
1724
  },
1725
  "node_modules/@typescript-eslint/parser": {
1726
  "version": "5.62.0",
 
2324
  }
2325
  },
2326
  "node_modules/caniuse-lite": {
2327
+ "version": "1.0.30001562",
2328
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001562.tgz",
2329
+ "integrity": "sha512-kfte3Hym//51EdX4239i+Rmp20EsLIYGdPkERegTgU19hQWCRhsRFGKHTliUlsry53tv17K7n077Kqa0WJU4ng==",
2330
  "funding": [
2331
  {
2332
  "type": "opencollective",
 
2770
  }
2771
  },
2772
  "node_modules/cookies-next/node_modules/@types/node": {
2773
+ "version": "16.18.61",
2774
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.61.tgz",
2775
+ "integrity": "sha512-k0N7BqGhJoJzdh6MuQg1V1ragJiXTh8VUBAZTWjJ9cUq23SG0F0xavOwZbhiP4J3y20xd6jxKx+xNUhkMAi76Q=="
2776
  },
2777
  "node_modules/create-require": {
2778
  "version": "1.1.1",
 
3054
  }
3055
  },
3056
  "node_modules/electron-to-chromium": {
3057
+ "version": "1.4.582",
3058
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.582.tgz",
3059
+ "integrity": "sha512-89o0MGoocwYbzqUUjc+VNpeOFSOK9nIdC5wY4N+PVUarUK0MtjyTjks75AZS2bW4Kl8MdewdFsWaH0jLy+JNoA=="
3060
  },
3061
  "node_modules/emoji-regex": {
3062
  "version": "9.2.2",
 
3724
  }
3725
  },
3726
  "node_modules/flat-cache": {
3727
+ "version": "3.2.0",
3728
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz",
3729
+ "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==",
3730
  "dependencies": {
3731
  "flatted": "^3.2.9",
3732
  "keyv": "^4.5.3",
3733
  "rimraf": "^3.0.2"
3734
  },
3735
  "engines": {
3736
+ "node": "^10.12.0 || >=12.0.0"
3737
  }
3738
  },
3739
  "node_modules/flatted": {
 
5160
  }
5161
  },
5162
  "node_modules/openai": {
5163
+ "version": "4.17.5",
5164
+ "resolved": "https://registry.npmjs.org/openai/-/openai-4.17.5.tgz",
5165
+ "integrity": "sha512-SDgA933/QOjISCgWRc/JQhY1HweYZ6FOie3bWrCpj09FA5xIlaomldbyzICHNjtkh7SWEmGYFjRHIDtuwr+eTw==",
5166
  "dependencies": {
5167
  "@types/node": "^18.11.18",
5168
  "@types/node-fetch": "^2.6.4",
 
5179
  }
5180
  },
5181
  "node_modules/openai/node_modules/@types/node": {
5182
+ "version": "18.18.9",
5183
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz",
5184
+ "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==",
5185
  "dependencies": {
5186
  "undici-types": "~5.26.4"
5187
  }
 
5644
  }
5645
  },
5646
  "node_modules/react-icons": {
5647
+ "version": "4.12.0",
5648
+ "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.12.0.tgz",
5649
+ "integrity": "sha512-IBaDuHiShdZqmfc/TwHu6+d6k2ltNCf3AszxNmjJc1KUfXdEeRJOKyNvLmAHaarhzGmTSVygNdyu8/opXv2gaw==",
5650
  "peerDependencies": {
5651
  "react": "*"
5652
  }
 
6191
  }
6192
  },
6193
  "node_modules/streamx": {
6194
+ "version": "2.15.5",
6195
+ "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.5.tgz",
6196
+ "integrity": "sha512-9thPGMkKC2GctCzyCUjME3yR03x2xNo0GPKGkRw2UMYN+gqWa9uqpyNWhmsNCutU5zHmkUum0LsCRQTXUgUCAg==",
6197
  "dependencies": {
6198
  "fast-fifo": "^1.1.0",
6199
  "queue-tick": "^1.0.1"
package.json CHANGED
@@ -44,7 +44,7 @@
44
  "konva": "^9.2.2",
45
  "lucide-react": "^0.260.0",
46
  "next": "13.4.10",
47
- "openai": "^4.16.1",
48
  "pick": "^0.0.1",
49
  "postcss": "8.4.26",
50
  "react": "18.2.0",
 
44
  "konva": "^9.2.2",
45
  "lucide-react": "^0.260.0",
46
  "next": "13.4.10",
47
+ "openai": "^4.17.5",
48
  "pick": "^0.0.1",
49
  "postcss": "8.4.26",
50
  "react": "18.2.0",
src/app/engine/presets.ts CHANGED
@@ -115,7 +115,7 @@ export const presets: Record<string, Preset> = {
115
  imagePrompt: (prompt: string) => [
116
  "bande dessinΓ©e",
117
  "franco-belgian comic",
118
- `franco-belgian color comic about ${prompt}`,
119
  "comic album",
120
  "detailed drawing"
121
  // "color drawing"
@@ -140,7 +140,8 @@ export const presets: Record<string, Preset> = {
140
  llmPrompt: "american comic",
141
  imagePrompt: (prompt: string) => [
142
  "digital color comicbook style",
143
- `modern american comic about ${prompt}`,
 
144
  "detailed drawing"
145
  //"single panel",
146
  // "2010s",
@@ -169,7 +170,8 @@ export const presets: Record<string, Preset> = {
169
  font: "actionman",
170
  llmPrompt: "american comic",
171
  imagePrompt: (prompt: string) => [
172
- `american comic about ${prompt}`,
 
173
  "single panel",
174
  "american comic",
175
  "comicbook style",
@@ -201,7 +203,8 @@ export const presets: Record<string, Preset> = {
201
  imagePrompt: (prompt: string) => [
202
  "1950",
203
  "50s",
204
- `vintage american color comic about ${prompt}`,
 
205
  "detailed drawing"
206
  // "single panel",
207
  // "comicbook style",
@@ -228,7 +231,8 @@ export const presets: Record<string, Preset> = {
228
  font: "actionman",
229
  llmPrompt: "american comic",
230
  imagePrompt: (prompt: string) => [
231
- `american comic about ${prompt}`,
 
232
  "single panel",
233
  "american comic",
234
  "comicbook style",
 
115
  imagePrompt: (prompt: string) => [
116
  "bande dessinΓ©e",
117
  "franco-belgian comic",
118
+ prompt,
119
  "comic album",
120
  "detailed drawing"
121
  // "color drawing"
 
140
  llmPrompt: "american comic",
141
  imagePrompt: (prompt: string) => [
142
  "digital color comicbook style",
143
+ `modern american comic`,
144
+ prompt,
145
  "detailed drawing"
146
  //"single panel",
147
  // "2010s",
 
170
  font: "actionman",
171
  llmPrompt: "american comic",
172
  imagePrompt: (prompt: string) => [
173
+ `american comic`,
174
+ prompt,
175
  "single panel",
176
  "american comic",
177
  "comicbook style",
 
203
  imagePrompt: (prompt: string) => [
204
  "1950",
205
  "50s",
206
+ `vintage american color comic`,
207
+ prompt,
208
  "detailed drawing"
209
  // "single panel",
210
  // "comicbook style",
 
231
  font: "actionman",
232
  llmPrompt: "american comic",
233
  imagePrompt: (prompt: string) => [
234
+ `american comic`,
235
+ prompt,
236
  "single panel",
237
  "american comic",
238
  "comicbook style",
src/app/engine/render.ts CHANGED
@@ -353,6 +353,7 @@ export async function newRender({
353
  segments: []
354
  } as RenderedScene
355
  } else {
 
356
  console.log("sending:", {
357
  prompt,
358
  // negativePrompt, unused for now
@@ -376,6 +377,7 @@ export async function newRender({
376
 
377
  cache: "ignore"
378
  })
 
379
  const res = await fetch(`${videochainApiUrl}${videochainApiUrl.endsWith("/") ? "" : "/"}render`, {
380
  method: "POST",
381
  headers: {
 
353
  segments: []
354
  } as RenderedScene
355
  } else {
356
+ /*
357
  console.log("sending:", {
358
  prompt,
359
  // negativePrompt, unused for now
 
377
 
378
  cache: "ignore"
379
  })
380
+ */
381
  const res = await fetch(`${videochainApiUrl}${videochainApiUrl.endsWith("/") ? "" : "/"}render`, {
382
  method: "POST",
383
  headers: {
src/app/queries/getStory.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { createLlamaPrompt } from "@/lib/createLlamaPrompt"
2
- import { dirtyLLMResponseCleaner } from "@/lib/dirtyLLMResponseCleaner"
3
  import { dirtyLLMJsonParser } from "@/lib/dirtyLLMJsonParser"
4
  import { dirtyCaptionCleaner } from "@/lib/dirtyCaptionCleaner"
5
 
@@ -7,6 +6,7 @@ import { predict } from "./predict"
7
  import { Preset } from "../engine/presets"
8
  import { LLMResponse } from "@/types"
9
  import { cleanJson } from "@/lib/cleanJson"
 
10
 
11
  export const getStory = async ({
12
  preset,
@@ -22,22 +22,22 @@ export const getStory = async ({
22
  // In case you need to quickly debug the RENDERING engine you can uncomment this:
23
  // return mockLLMResponse
24
 
25
- const query = createLlamaPrompt([
26
  {
27
  role: "system",
28
  content: [
29
  `You are a writer specialized in ${preset.llmPrompt}`,
30
- `Please write detailed drawing instructions and a short (1 or 2 sentences long) speech caption for the ${nbTotalPanels} panels of a new story. Please make sure each of the ${nbTotalPanels} panels include info about character gender, age, origin, clothes, colors, location, lights, etc.`,
31
  `Give your response as a VALID JSON array like this: \`Array<{ panel: number; instructions: string; caption: string}>\`.`,
32
  // `Give your response as Markdown bullet points.`,
33
- `Be brief in your ${nbTotalPanels} instructions and narrative captions, don't add your own comments. Be straight to the point, and never reply things like "Sure, I can.." etc. Reply using valid JSON.`
34
  ].filter(item => item).join("\n")
35
  },
36
  {
37
  role: "user",
38
  content: `The story is: ${prompt}`,
39
  }
40
- ]) + "```json\n["
41
 
42
 
43
  let result = ""
 
1
+
 
2
  import { dirtyLLMJsonParser } from "@/lib/dirtyLLMJsonParser"
3
  import { dirtyCaptionCleaner } from "@/lib/dirtyCaptionCleaner"
4
 
 
6
  import { Preset } from "../engine/presets"
7
  import { LLMResponse } from "@/types"
8
  import { cleanJson } from "@/lib/cleanJson"
9
+ import { createZephyrPrompt } from "@/lib/createZephyrPrompt"
10
 
11
  export const getStory = async ({
12
  preset,
 
22
  // In case you need to quickly debug the RENDERING engine you can uncomment this:
23
  // return mockLLMResponse
24
 
25
+ const query = createZephyrPrompt([
26
  {
27
  role: "system",
28
  content: [
29
  `You are a writer specialized in ${preset.llmPrompt}`,
30
+ `Please write detailed drawing instructions and a short (2-3 sentences long) speech caption for the ${nbTotalPanels} panels of a new story. Please make sure each of the ${nbTotalPanels} panels include info about character gender, age, origin, clothes, colors, location, lights, etc.`,
31
  `Give your response as a VALID JSON array like this: \`Array<{ panel: number; instructions: string; caption: string}>\`.`,
32
  // `Give your response as Markdown bullet points.`,
33
+ `Be brief in your ${nbTotalPanels} instructions and narrative captions, don't add your own comments. The whole story must be captivating, smart, entertaining. Be straight to the point, and never reply things like "Sure, I can.." etc. Reply using valid JSON.`
34
  ].filter(item => item).join("\n")
35
  },
36
  {
37
  role: "user",
38
  content: `The story is: ${prompt}`,
39
  }
40
+ ]) + "[{"
41
 
42
 
43
  let result = ""
src/app/queries/predictWithHuggingFace.ts CHANGED
@@ -62,11 +62,16 @@ export async function predict(inputs: string, nbPanels: number): Promise<string>
62
  if (
63
  instructions.includes("</s>") ||
64
  instructions.includes("<s>") ||
 
65
  instructions.includes("[INST]") ||
66
  instructions.includes("[/INST]") ||
67
  instructions.includes("<SYS>") ||
 
68
  instructions.includes("</SYS>") ||
 
 
69
  instructions.includes("<|end|>") ||
 
70
  instructions.includes("<|assistant|>")
71
  ) {
72
  break
@@ -87,10 +92,16 @@ export async function predict(inputs: string, nbPanels: number): Promise<string>
87
  .replaceAll("<|end|>", "")
88
  .replaceAll("<s>", "")
89
  .replaceAll("</s>", "")
 
90
  .replaceAll("[INST]", "")
91
  .replaceAll("[/INST]", "")
92
  .replaceAll("<SYS>", "")
 
93
  .replaceAll("</SYS>", "")
 
 
 
 
94
  .replaceAll("<|assistant|>", "")
95
  .replaceAll('""', '"')
96
  )
 
62
  if (
63
  instructions.includes("</s>") ||
64
  instructions.includes("<s>") ||
65
+ instructions.includes("/s>") ||
66
  instructions.includes("[INST]") ||
67
  instructions.includes("[/INST]") ||
68
  instructions.includes("<SYS>") ||
69
+ instructions.includes("<<SYS>>") ||
70
  instructions.includes("</SYS>") ||
71
+ instructions.includes("<</SYS>>") ||
72
+ instructions.includes("<|user|>") ||
73
  instructions.includes("<|end|>") ||
74
+ instructions.includes("<|system|>") ||
75
  instructions.includes("<|assistant|>")
76
  ) {
77
  break
 
92
  .replaceAll("<|end|>", "")
93
  .replaceAll("<s>", "")
94
  .replaceAll("</s>", "")
95
+ .replaceAll("/s>", "")
96
  .replaceAll("[INST]", "")
97
  .replaceAll("[/INST]", "")
98
  .replaceAll("<SYS>", "")
99
+ .replaceAll("<<SYS>>", "")
100
  .replaceAll("</SYS>", "")
101
+ .replaceAll("<</SYS>>", "")
102
+ .replaceAll("<|system|>", "")
103
+ .replaceAll("<|user|>", "")
104
+ .replaceAll("<|all|>", "")
105
  .replaceAll("<|assistant|>", "")
106
  .replaceAll('""', '"')
107
  )
src/lib/createLlamaPrompt.ts CHANGED
@@ -3,7 +3,7 @@ export function createLlamaPrompt(messages: Array<{ role: string, content: strin
3
  const B_INST = "[INST]", E_INST = "[/INST]";
4
  const B_SYS = "<<SYS>>\n", E_SYS = "\n<</SYS>>\n\n";
5
  const BOS = "<s>", EOS = "</s>";
6
- const DEFAULT_SYSTEM_PROMPT = "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.";
7
 
8
  if (messages[0].role != "system"){
9
  messages = [
 
3
  const B_INST = "[INST]", E_INST = "[/INST]";
4
  const B_SYS = "<<SYS>>\n", E_SYS = "\n<</SYS>>\n\n";
5
  const BOS = "<s>", EOS = "</s>";
6
+ const DEFAULT_SYSTEM_PROMPT = "You are a helpful, respectful and honest storywriting assistant. Always answer in a creative and entertaining way, while being safe. Please ensure that your stories and captions are socially unbiased and positive in nature. If a request does not make any sense, go on anyway, as we are writing a fantasy story.";
7
 
8
  if (messages[0].role != "system"){
9
  messages = [
src/lib/createZephyrPrompt.ts ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ interface Message {
3
+ role: "system" | "user" | "assistant";
4
+ content: string;
5
+ }
6
+
7
+ /**
8
+ * Formats the messages for the chat with the LLM model in the style of a pirate.
9
+ * @param messages - Array of message objects with role and content.
10
+ * @param systemMessage - The system's initial instructions, defaulted to a friendly pirate-style chatbot.
11
+ * @returns The formatted chat prompt.
12
+ */
13
+ export function createZephyrPrompt(messages: Message[]): string {
14
+ let prompt = ``;
15
+
16
+ // Iterate over messages and generate corresponding chat entries.
17
+ messages.forEach(message => {
18
+ prompt += `<|${message.role}|>\n${message.content.trim()}</s>`;
19
+ });
20
+
21
+ if (messages.at(-1)?.role === "user") {
22
+ // Append the assistant's tag for the next response but without a closing tag.
23
+ prompt += `<|assistant|>`;
24
+ }
25
+
26
+ return prompt;
27
+ }