Merge branch 'main' of Niek/chatgpt-web

This commit is contained in:
2024-07-19 03:48:52 +09:00
5 changed files with 54 additions and 31 deletions

1
.env
View File

@@ -3,3 +3,4 @@
#VITE_ENDPOINT_COMPLETIONS=/v1/chat/completions
#VITE_ENDPOINT_MODELS=/v1/models
#VITE_RENDER_LATEX=false
#VITE_OPENAI_API_KEY="your-openai-api-key"

61
package-lock.json generated
View File

@@ -19,7 +19,7 @@
"@tsconfig/svelte": "^5.0.0",
"@types/dompurify": "^3.0.5",
"@types/marked": "^6.0.0",
"@types/node": "^20.10.7",
"@types/node": "^20.14.9",
"bulma": "^0.9.4",
"bulma-prefers-dark": "^0.1.0-beta.1",
"copy-to-clipboard": "^3.3.3",
@@ -27,24 +27,24 @@
"dompurify": "^3.0.6",
"eslint-config-standard-with-typescript": "^35.0.0",
"eslint-plugin-svelte3": "^4.0.0",
"flourite": "^1.2.4",
"flourite": "^1.3.0",
"gpt-tokenizer": "^2.1.2",
"katex": "^0.16.10",
"llama-tokenizer-js": "^1.2.2",
"postcss": "^8.4.32",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.69.7",
"sass": "^1.77.6",
"stacking-order": "^2.0.0",
"svelte": "^3.59.2",
"svelte-check": "^3.6.2",
"svelte-fa": "^3.0.3",
"svelte-highlight": "^7.4.7",
"svelte-highlight": "^7.6.1",
"svelte-local-storage-store": "^0.6.4",
"svelte-markdown": "^0.2.3",
"svelte-modals": "^1.2.1",
"svelte-spa-router": "^4.0.1",
"svelte-typeahead": "^4.4.1",
"svelte-use-click-outside": "^1.0.0",
"tslib": "^2.6.2",
"tslib": "^2.6.3",
"typescript": "^5.0.4",
"uuid": "^9.0.1",
"vite": "^4.5.1"
@@ -1000,9 +1000,9 @@
}
},
"node_modules/@types/node": {
"version": "20.12.8",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.8.tgz",
"integrity": "sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==",
"version": "20.14.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz",
"integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
@@ -2754,15 +2754,22 @@
"peer": true
},
"node_modules/flourite": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/flourite/-/flourite-1.2.4.tgz",
"integrity": "sha512-vaqp9ghYgrIhba70L6upC4KXPs1h0vWI9MlYEyz8KwhNYAwVtV7w8UyO0xIQ/+hOdYqFwQFnJmvsoO0pNef6Cg==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/flourite/-/flourite-1.3.0.tgz",
"integrity": "sha512-iuhWXuX07QwHMnJ1Irh4sD1bk/QFMHg8jVgWsjSAqoIqgIyJtRPnUNKyZAPXrw7pQkDvxb5AIz2KPihEoyVcqw==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/teknologi-umum"
},
{
"type": "saweria",
"url": "https://saweria.co/teknologiumum"
}
],
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://saweria.co/teknologiumum"
}
},
"node_modules/for-each": {
@@ -3690,6 +3697,12 @@
"node": ">= 0.8.0"
}
},
"node_modules/llama-tokenizer-js": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/llama-tokenizer-js/-/llama-tokenizer-js-1.2.2.tgz",
"integrity": "sha512-Wmth393dc3odWU3IzARJ3r2oIfWgw9GdJ5Gm+hGhfECNO18UHLRqEFSf511jn4E9KcQGzuuKw4Wl08pHAemLAw==",
"dev": true
},
"node_modules/locate-path": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
@@ -4560,9 +4573,9 @@
}
},
"node_modules/sass": {
"version": "1.76.0",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.76.0.tgz",
"integrity": "sha512-nc3LeqvF2FNW5xGF1zxZifdW3ffIz5aBb7I7tSvOoNu7z1RQ6pFt9MBuiPtjgaI62YWrM/txjWlOCFiGtf2xpw==",
"version": "1.77.6",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.77.6.tgz",
"integrity": "sha512-ByXE1oLD79GVq9Ht1PeHWCPMPB8XHpBuz1r85oByKHjZY6qV6rWnQovQzXJXuQ/XyE1Oj3iPk3lo28uzaRA2/Q==",
"dev": true,
"dependencies": {
"chokidar": ">=3.0.0 <4.0.0",
@@ -4979,9 +4992,9 @@
"dev": true
},
"node_modules/svelte-highlight": {
"version": "7.6.0",
"resolved": "https://registry.npmjs.org/svelte-highlight/-/svelte-highlight-7.6.0.tgz",
"integrity": "sha512-J9X1d07iMIKZMAqNAhlkjLX/FS+7R2lPrqVul7i+EleVZIOYvBhtx7ES62bc661a70nKNOS05yr9JAvyQPPOIA==",
"version": "7.6.1",
"resolved": "https://registry.npmjs.org/svelte-highlight/-/svelte-highlight-7.6.1.tgz",
"integrity": "sha512-YIpA6LBVpghQndBsbZQLl3ufEje179vQTtC7FH/utbEmUwYecIXsBq4mcwNkCeUuCrpcaF0DkrppWmMp/ZoPfA==",
"dev": true,
"dependencies": {
"highlight.js": "11.9.0"
@@ -5196,9 +5209,9 @@
}
},
"node_modules/tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz",
"integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==",
"dev": true
},
"node_modules/tsutils": {

View File

@@ -25,7 +25,7 @@
"@tsconfig/svelte": "^5.0.0",
"@types/dompurify": "^3.0.5",
"@types/marked": "^6.0.0",
"@types/node": "^20.10.7",
"@types/node": "^20.14.9",
"bulma": "^0.9.4",
"bulma-prefers-dark": "^0.1.0-beta.1",
"copy-to-clipboard": "^3.3.3",
@@ -33,24 +33,24 @@
"dompurify": "^3.0.6",
"eslint-config-standard-with-typescript": "^35.0.0",
"eslint-plugin-svelte3": "^4.0.0",
"flourite": "^1.2.4",
"flourite": "^1.3.0",
"gpt-tokenizer": "^2.1.2",
"katex": "^0.16.10",
"llama-tokenizer-js": "^1.2.2",
"postcss": "^8.4.32",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.69.7",
"sass": "^1.77.6",
"stacking-order": "^2.0.0",
"svelte": "^3.59.2",
"svelte-check": "^3.6.2",
"svelte-fa": "^3.0.3",
"svelte-highlight": "^7.4.7",
"svelte-highlight": "^7.6.1",
"svelte-local-storage-store": "^0.6.4",
"svelte-markdown": "^0.2.3",
"svelte-modals": "^1.2.1",
"svelte-spa-router": "^4.0.1",
"svelte-typeahead": "^4.4.1",
"svelte-use-click-outside": "^1.0.0",
"tslib": "^2.6.2",
"tslib": "^2.6.3",
"typescript": "^5.0.4",
"uuid": "^9.0.1",
"vite": "^4.5.1"

View File

@@ -13,7 +13,8 @@
export const chatsStorage = persisted('chats', [] as Chat[])
export const latestModelMap = persisted('latestModelMap', {} as Record<Model, Model>) // What was returned when a model was requested
export const globalStorage = persisted('global', {} as GlobalSettings)
export const apiKeyStorage = persisted('apiKey', '' as string)
const apiKeyFromEnv = import.meta.env.VITE_OPENAI_API_KEY || ''
export const apiKeyStorage = persisted('apiKey', apiKeyFromEnv as string)
export let checkStateChange = writable(0) // Trigger for Chat
export let showSetChatSettings = writable(false) //
export let submitExitingPromptsNow = writable(false) // for them to go now. Will not submit anything in the input

View File

@@ -81,6 +81,12 @@ const gpt4o = {
completion: 0.000015, // $0.015 per 1000 tokens completion
max: 131072 // 128k max token buffer
}
const gpt4omini = {
...chatModelBase,
prompt: 0.00000015, // $0.00015 per 1000 tokens prompt
completion: 0.00000060, // $0.00060 per 1000 tokens completion
max: 131072 // 128k max token buffer
}
const gpt432k = {
...chatModelBase,
prompt: 0.00006, // $0.06 per 1000 tokens prompt
@@ -110,6 +116,8 @@ export const chatModels : Record<string, ModelDetail> = {
'gpt-3.5-turbo-16k-0613': { ...gpt3516k },
'gpt-4': { ...gpt4 },
'gpt-4o': { ...gpt4o },
'gpt-4o-mini': { ...gpt4omini },
'gpt-4o-mini-2024-07-18': { ...gpt4omini },
'gpt-4-turbo-preview': { ...gpt4128kpreview },
'gpt-4-turbo-2024-04-09': { ...gpt4128kpreview },
'gpt-4-0314': { ...gpt4 },