Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Administrator
/
chatgpt.ai-pro.org
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
3
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
2a5afc6b
authored
2023-02-02 08:33:00 +0800
by
RSA
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
wip
1 parent
f00232ef
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
264 additions
and
27 deletions
client/package-lock.json
client/package.json
client/public/index.html
client/src/App.css
client/src/App.js
client/src/ChatBox.js
client/src/color_theme_1.css
client/package-lock.json
View file @
2a5afc6
...
...
@@ -2810,6 +2810,14 @@
"@types/node"
:
"*"
}
},
"@types/hast"
:
{
"version"
:
"2.3.4"
,
"resolved"
:
"https://registry.npmjs.org/@types/hast/-/hast-2.3.4.tgz"
,
"integrity"
:
"sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g=="
,
"requires"
:
{
"@types/unist"
:
"*"
}
},
"@types/html-minifier-terser"
:
{
"version"
:
"6.1.0"
,
"resolved"
:
"https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz"
,
...
...
@@ -2921,6 +2929,14 @@
"@types/react"
:
"*"
}
},
"@types/react-syntax-highlighter"
:
{
"version"
:
"15.5.6"
,
"resolved"
:
"https://registry.npmjs.org/@types/react-syntax-highlighter/-/react-syntax-highlighter-15.5.6.tgz"
,
"integrity"
:
"sha512-i7wFuLbIAFlabTeD2I1cLjEOrG/xdMa/rpx2zwzAoGHuXJDhSqp9BSfDlMHSh9JSuNfxHk9eEmMX6D55GiyjGg=="
,
"requires"
:
{
"@types/react"
:
"*"
}
},
"@types/resolve"
:
{
"version"
:
"1.17.1"
,
"resolved"
:
"https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz"
,
...
...
@@ -2987,6 +3003,11 @@
"resolved"
:
"https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz"
,
"integrity"
:
"sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg=="
},
"@types/unist"
:
{
"version"
:
"2.0.6"
,
"resolved"
:
"https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz"
,
"integrity"
:
"sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ=="
},
"@types/ws"
:
{
"version"
:
"8.5.4"
,
"resolved"
:
"https://registry.npmjs.org/@types/ws/-/ws-8.5.4.tgz"
,
...
...
@@ -4000,6 +4021,21 @@
"resolved"
:
"https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz"
,
"integrity"
:
"sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw=="
},
"character-entities"
:
{
"version"
:
"1.2.4"
,
"resolved"
:
"https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz"
,
"integrity"
:
"sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw=="
},
"character-entities-legacy"
:
{
"version"
:
"1.1.4"
,
"resolved"
:
"https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz"
,
"integrity"
:
"sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA=="
},
"character-reference-invalid"
:
{
"version"
:
"1.1.4"
,
"resolved"
:
"https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz"
,
"integrity"
:
"sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg=="
},
"check-types"
:
{
"version"
:
"11.2.2"
,
"resolved"
:
"https://registry.npmjs.org/check-types/-/check-types-11.2.2.tgz"
,
...
...
@@ -4167,6 +4203,11 @@
"delayed-stream"
:
"~1.0.0"
}
},
"comma-separated-tokens"
:
{
"version"
:
"1.0.8"
,
"resolved"
:
"https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz"
,
"integrity"
:
"sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw=="
},
"commander"
:
{
"version"
:
"7.2.0"
,
"resolved"
:
"https://registry.npmjs.org/commander/-/commander-7.2.0.tgz"
,
...
...
@@ -5695,6 +5736,14 @@
"reusify"
:
"^1.0.4"
}
},
"fault"
:
{
"version"
:
"1.0.4"
,
"resolved"
:
"https://registry.npmjs.org/fault/-/fault-1.0.4.tgz"
,
"integrity"
:
"sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA=="
,
"requires"
:
{
"format"
:
"^0.2.0"
}
},
"faye-websocket"
:
{
"version"
:
"0.11.4"
,
"resolved"
:
"https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz"
,
...
...
@@ -5921,6 +5970,11 @@
"mime-types"
:
"^2.1.12"
}
},
"format"
:
{
"version"
:
"0.2.2"
,
"resolved"
:
"https://registry.npmjs.org/format/-/format-0.2.2.tgz"
,
"integrity"
:
"sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww=="
},
"forwarded"
:
{
"version"
:
"0.2.0"
,
"resolved"
:
"https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz"
,
...
...
@@ -6187,11 +6241,33 @@
"has-symbols"
:
"^1.0.2"
}
},
"hast-util-parse-selector"
:
{
"version"
:
"2.2.5"
,
"resolved"
:
"https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.5.tgz"
,
"integrity"
:
"sha512-7j6mrk/qqkSehsM92wQjdIgWM2/BW61u/53G6xmC8i1OmEdKLHbk419QKQUjz6LglWsfqoiHmyMRkP1BGjecNQ=="
},
"hastscript"
:
{
"version"
:
"6.0.0"
,
"resolved"
:
"https://registry.npmjs.org/hastscript/-/hastscript-6.0.0.tgz"
,
"integrity"
:
"sha512-nDM6bvd7lIqDUiYEiu5Sl/+6ReP0BMk/2f4U/Rooccxkj0P5nm+acM5PrGJ/t5I8qPGiqZSE6hVAwZEdZIvP4w=="
,
"requires"
:
{
"@types/hast"
:
"^2.0.0"
,
"comma-separated-tokens"
:
"^1.0.0"
,
"hast-util-parse-selector"
:
"^2.0.0"
,
"property-information"
:
"^5.0.0"
,
"space-separated-tokens"
:
"^1.0.0"
}
},
"he"
:
{
"version"
:
"1.2.0"
,
"resolved"
:
"https://registry.npmjs.org/he/-/he-1.2.0.tgz"
,
"integrity"
:
"sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
},
"highlight.js"
:
{
"version"
:
"10.7.3"
,
"resolved"
:
"https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz"
,
"integrity"
:
"sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A=="
},
"hoopy"
:
{
"version"
:
"0.1.4"
,
"resolved"
:
"https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz"
,
...
...
@@ -6489,6 +6565,20 @@
"resolved"
:
"https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.0.1.tgz"
,
"integrity"
:
"sha512-1qTgH9NG+IIJ4yfKs2e6Pp1bZg8wbDbKHT21HrLIeYBTRLgMYKnMTPAuI3Lcs61nfx5h1xlXnbJtH1kX5/d/ng=="
},
"is-alphabetical"
:
{
"version"
:
"1.0.4"
,
"resolved"
:
"https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz"
,
"integrity"
:
"sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg=="
},
"is-alphanumerical"
:
{
"version"
:
"1.0.4"
,
"resolved"
:
"https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz"
,
"integrity"
:
"sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A=="
,
"requires"
:
{
"is-alphabetical"
:
"^1.0.0"
,
"is-decimal"
:
"^1.0.0"
}
},
"is-arguments"
:
{
"version"
:
"1.1.1"
,
"resolved"
:
"https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz"
,
...
...
@@ -6559,6 +6649,11 @@
"has-tostringtag"
:
"^1.0.0"
}
},
"is-decimal"
:
{
"version"
:
"1.0.4"
,
"resolved"
:
"https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz"
,
"integrity"
:
"sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw=="
},
"is-docker"
:
{
"version"
:
"2.2.1"
,
"resolved"
:
"https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz"
,
...
...
@@ -6587,6 +6682,11 @@
"is-extglob"
:
"^2.1.1"
}
},
"is-hexadecimal"
:
{
"version"
:
"1.0.4"
,
"resolved"
:
"https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz"
,
"integrity"
:
"sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw=="
},
"is-map"
:
{
"version"
:
"2.0.2"
,
"resolved"
:
"https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz"
,
...
...
@@ -8889,6 +8989,15 @@
}
}
},
"lowlight"
:
{
"version"
:
"1.20.0"
,
"resolved"
:
"https://registry.npmjs.org/lowlight/-/lowlight-1.20.0.tgz"
,
"integrity"
:
"sha512-8Ktj+prEb1RoCPkEOrPMYUN/nCggB7qAWe3a7OpMjWQkh3l2RD5wKRQ+o8Q8YuI9RG/xs95waaI/E6ym/7NsTw=="
,
"requires"
:
{
"fault"
:
"^1.0.0"
,
"highlight.js"
:
"~10.7.0"
}
},
"lru-cache"
:
{
"version"
:
"5.1.1"
,
"resolved"
:
"https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz"
,
...
...
@@ -9386,6 +9495,19 @@
"callsites"
:
"^3.0.0"
}
},
"parse-entities"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz"
,
"integrity"
:
"sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ=="
,
"requires"
:
{
"character-entities"
:
"^1.0.0"
,
"character-entities-legacy"
:
"^1.0.0"
,
"character-reference-invalid"
:
"^1.0.0"
,
"is-alphanumerical"
:
"^1.0.0"
,
"is-decimal"
:
"^1.0.0"
,
"is-hexadecimal"
:
"^1.0.0"
}
},
"parse-json"
:
{
"version"
:
"5.2.0"
,
"resolved"
:
"https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz"
,
...
...
@@ -10288,6 +10410,11 @@
}
}
},
"prismjs"
:
{
"version"
:
"1.29.0"
,
"resolved"
:
"https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz"
,
"integrity"
:
"sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q=="
},
"process-nextick-args"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
"https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz"
,
...
...
@@ -10327,6 +10454,14 @@
}
}
},
"property-information"
:
{
"version"
:
"5.6.0"
,
"resolved"
:
"https://registry.npmjs.org/property-information/-/property-information-5.6.0.tgz"
,
"integrity"
:
"sha512-YUHSPk+A30YPv+0Qf8i9Mbfe/C0hdPXk1s1jPVToV8pk8BQtpw10ct89Eo7OWkutrwqvT0eicAxlOg3dOAu8JA=="
,
"requires"
:
{
"xtend"
:
"^4.0.0"
}
},
"proxy-addr"
:
{
"version"
:
"2.0.7"
,
"resolved"
:
"https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz"
,
...
...
@@ -10577,6 +10712,18 @@
"workbox-webpack-plugin"
:
"^6.4.1"
}
},
"react-syntax-highlighter"
:
{
"version"
:
"13.5.3"
,
"resolved"
:
"https://registry.npmjs.org/react-syntax-highlighter/-/react-syntax-highlighter-13.5.3.tgz"
,
"integrity"
:
"sha512-crPaF+QGPeHNIblxxCdf2Lg936NAHKhNhuMzRL3F9ct6aYXL3NcZtCL0Rms9+qVo6Y1EQLdXGypBNSbPL/r+qg=="
,
"requires"
:
{
"@babel/runtime"
:
"^7.3.1"
,
"highlight.js"
:
"^10.1.1"
,
"lowlight"
:
"^1.14.0"
,
"prismjs"
:
"^1.21.0"
,
"refractor"
:
"^3.1.0"
}
},
"read-cache"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz"
,
...
...
@@ -10620,6 +10767,23 @@
"strip-indent"
:
"^3.0.0"
}
},
"refractor"
:
{
"version"
:
"3.6.0"
,
"resolved"
:
"https://registry.npmjs.org/refractor/-/refractor-3.6.0.tgz"
,
"integrity"
:
"sha512-MY9W41IOWxxk31o+YvFCNyNzdkc9M20NoZK5vq6jkv4I/uh2zkWcfudj0Q1fovjUQJrNewS9NMzeTtqPf+n5EA=="
,
"requires"
:
{
"hastscript"
:
"^6.0.0"
,
"parse-entities"
:
"^2.0.0"
,
"prismjs"
:
"~1.27.0"
},
"dependencies"
:
{
"prismjs"
:
{
"version"
:
"1.27.0"
,
"resolved"
:
"https://registry.npmjs.org/prismjs/-/prismjs-1.27.0.tgz"
,
"integrity"
:
"sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA=="
}
}
},
"regenerate"
:
{
"version"
:
"1.4.2"
,
"resolved"
:
"https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz"
,
...
...
@@ -11252,6 +11416,11 @@
"resolved"
:
"https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz"
,
"integrity"
:
"sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA=="
},
"space-separated-tokens"
:
{
"version"
:
"1.1.5"
,
"resolved"
:
"https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-1.1.5.tgz"
,
"integrity"
:
"sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA=="
},
"spdy"
:
{
"version"
:
"4.0.2"
,
"resolved"
:
"https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz"
,
...
...
client/package.json
View file @
2a5afc6
...
...
@@ -6,10 +6,12 @@
"@testing-library/jest-dom"
:
"^5.16.5"
,
"@testing-library/react"
:
"^13.4.0"
,
"@testing-library/user-event"
:
"^13.5.0"
,
"@types/react-syntax-highlighter"
:
"^15.5.6"
,
"react"
:
"^18.2.0"
,
"react-dom"
:
"^18.2.0"
,
"react-openai-api"
:
"^1.0.2"
,
"react-scripts"
:
"5.0.1"
,
"react-syntax-highlighter"
:
"^13.2.1"
,
"web-vitals"
:
"^2.1.4"
},
"scripts"
:
{
...
...
client/public/index.html
View file @
2a5afc6
...
...
@@ -2,19 +2,20 @@
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
/>
<link
rel=
"icon"
href=
"%PUBLIC_URL%/favicon.ico"
/>
<!-- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> -->
<link
rel=
"icon"
type=
"image/png"
sizes=
"32x32"
href=
"%PUBLIC_URL%/favicon-32x32.png"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<meta
name=
"theme-color"
content=
"#000000"
/>
<meta
name=
"description"
content=
"Web site created using create-react-app"
/>
<
link
rel=
"apple-touch-icon"
href=
"%PUBLIC_URL%/logo192.png"
/
>
<
!-- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> --
>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<
link
rel=
"manifest"
href=
"%PUBLIC_URL%/manifest.json"
/
>
<
!-- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> --
>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
...
...
client/src/App.css
View file @
2a5afc6
...
...
@@ -59,7 +59,6 @@
position
:
absolute
;
bottom
:
0
;
left
:
0
;
right
:
0
;
background
:
rgb
(
57
57
57
);
}
.chat-input-textarea
{
background-color
:
#40414f
;
...
...
@@ -96,8 +95,10 @@
}
.chat-message.chatgpt
{
background-color
:
#
ffffff
;
background-color
:
#
444654
;
}
.chat-message-center
{
max-width
:
640px
;
margin-left
:
auto
;
...
...
@@ -106,9 +107,6 @@
padding
:
12px
24px
;
}
section
::-webkit-scrollbar
{
display
:
none
;
}
.avatar
{
background
:
#ffffff
;
border-radius
:
50%
;
...
...
@@ -135,9 +133,7 @@ section::-webkit-scrollbar {
padding
:
7px
20px
;
}
.chat-message.false
{
background
:
#eef2ff
;
}
@keyframes
App-logo-spin
{
from
{
...
...
client/src/App.js
View file @
2a5afc6
...
...
@@ -4,7 +4,9 @@ import './color_theme_1.css';
import
{
useState
,
useEffect
}
from
'react'
;
import
SideMenu
from
'./SideMenu'
import
ChatBox
from
'./ChatBox'
import
OpenAIAPI
from
"react-openai-api"
;
// import OpenAIAPI from "react-openai-api";
//import { CopyBlock } from "react-code-blocks";
//import { CopyBlock, dracula } from "react-code-blocks";
function
App
()
{
...
...
@@ -27,18 +29,38 @@ function App() {
}
function
getEngines
(){
fetch
(
"http://localhost:3080/models"
)
// fetch("http://localhost:3080/models")
// .then(res => res.json())
// .then(data => {
// console.log(data.models.data)
// // set models in order alpahbetically
// data.models.data.sort((a, b) => {
// if(a.id < b.id) { return -1; }
// if(a.id > b.id) { return 1; }
// return 0;
// })
// setModels(data.models.data)
// })
var
myHeaders
=
new
Headers
();
myHeaders
.
append
(
"Authorization"
,
"Bearer "
+
"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"
);
var
requestOptions
=
{
method
:
'GET'
,
headers
:
myHeaders
,
redirect
:
'follow'
};
fetch
(
"https://api.openai.com/v1/models"
,
requestOptions
)
.
then
(
res
=>
res
.
json
())
.
then
(
data
=>
{
console
.
log
(
data
.
models
.
data
)
// set models in order alpahbetically
data
.
models
.
data
.
sort
((
a
,
b
)
=>
{
if
(
a
.
id
<
b
.
id
)
{
return
-
1
;
}
if
(
a
.
id
>
b
.
id
)
{
return
1
;
}
data
.
data
.
sort
((
a
,
b
)
=>
{
if
(
a
.
id
<
b
.
id
)
{
return
-
1
;
}
if
(
a
.
id
>
b
.
id
)
{
return
1
;
}
return
0
;
})
setModels
(
data
.
models
.
data
)
})
setModels
(
data
.
data
)
}).
catch
(
error
=>
console
.
log
(
'error'
,
error
));
}
async
function
handleSubmit
(
e
){
...
...
@@ -73,6 +95,7 @@ function App() {
oHttp
.
onreadystatechange
=
function
()
{
if
(
oHttp
.
readyState
===
4
)
{
console
.
log
(
"11111"
,
oHttp
.
responseText
);
var
s
=
''
var
oJson
=
{}
if
(
s
!=
""
)
s
+=
"\n"
;
...
...
@@ -97,15 +120,21 @@ function App() {
// }
if
(
s
==
""
)
s
=
"No response"
;
console
.
log
(
'ssssssssssssssssssssss'
,
s
);
var
replaceBR
=
(
s
.
replace
(
/
(?:\r\n
|
\r
|
\n)
/g
,
"<br>"
)).
replace
(
/
\r?\n
|
\r
/
,
""
);
setChatLog
([...
chatLogNew
,
{
user
:
"gpt"
,
message
:
`
${
replaceBR
}
`
}
]);
var
replaceBR
=
(
s
.
replace
(
/
(?:\r\n
|
\r
|
\n)
/g
,
"<br>"
));
console
.
log
(
'replaceBR replaceBR'
,
replaceBR
);
//var replaceBR = (s.replace(/(?:\r\n|\r|\n)/g, "<br>")).replace(/\r?\n|\r/, "");
var
newStr
=
replaceBR
.
replace
(
/^
(
<br>
)
+/
,
""
);
var
newStr11
=
newStr
.
replace
(
/<br><br>/g
,
"<br>"
);
setChatLog
([...
chatLogNew
,
{
user
:
"gpt"
,
message
:
`
${
s
}
`
}]);
// setChatLog([...chatLogNew, { user: "gpt", message: `${replaceBR}`} ]);
}
}
};
var
sModel
=
currentModel
;
// "text-davinci-003";
var
iMaxTokens
=
100
;
var
iMaxTokens
=
2048
;
var
sUserId
=
"1"
;
var
dTemperature
=
temperature
;
...
...
@@ -115,12 +144,13 @@ function App() {
max_tokens
:
iMaxTokens
,
//user: sUserId,
temperature
:
dTemperature
,
//
frequency_penalty: 0.0, //Number between -2.0 and 2.0 Positive value decrease the model's likelihood to repeat the same line verbatim.
//
presence_penalty: 0.0, //Number between -2.0 and 2.0. Positive values increase the model's likelihood to talk about new topics.
frequency_penalty
:
0.0
,
//Number between -2.0 and 2.0 Positive value decrease the model's likelihood to repeat the same line verbatim.
presence_penalty
:
0.0
,
//Number between -2.0 and 2.0. Positive values increase the model's likelihood to talk about new topics.
//stop: ["#", ";"] //Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
stop
:[
"\"\"\""
]
}
oHttp
.
send
(
JSON
.
stringify
(
data
));
;
oHttp
.
send
(
JSON
.
stringify
(
data
));
}
...
...
@@ -150,6 +180,18 @@ function App() {
chatLog
=
{
chatLog
}
setChatInput
=
{
setChatInput
}
handleSubmit
=
{
handleSubmit
}
/
>
{
/*
<CopyBlock
text={ chatLog.map((message, index) => (
<>
{message.message}
</>
))}
language="text"
showLineNumbers={true}
theme={dracula}
codeBlock
/> */
}
<
/div
>
);
}
...
...
client/src/ChatBox.js
View file @
2a5afc6
import
OpenAISVGLogo
from
'./OpenAISVGLogo'
// import OpenAISVGLogo from './OpenAISVGLogo'
import
{
Light
as
SyntaxHighlighter
}
from
'react-syntax-highlighter'
;
import
arduino
from
'react-syntax-highlighter/dist/cjs/languages/hljs/arduino'
;
import
{
arduinoLight
}
from
'react-syntax-highlighter/dist/cjs/styles/hljs'
;
import
atelierCaveDark
from
"react-syntax-highlighter/dist/esm/styles/hljs/atelier-cave-dark"
;
SyntaxHighlighter
.
registerLanguage
(
'arduino'
,
arduino
);
// Primary Chat Window
const
ChatBox
=
({
chatLog
,
setChatInput
,
handleSubmit
,
chatInput
})
=>
...
...
@@ -31,7 +36,14 @@ const ChatMessage = ({ message }) => {
{
/* <div className="message">
{message.message}
</div> */
}
<
div
className
=
"message"
dangerouslySetInnerHTML
=
{{
__html
:
message
.
message
}}
/
>
{
/* <div className="message" dangerouslySetInnerHTML={{ __html: message.message }} /> */
}
{
message
.
user
===
"gpt"
?
<
div
className
=
"message"
><
SyntaxHighlighter
className
=
"syntaxhighlight"
language
=
"react"
style
=
{
arduinoLight
}
>
{
message
.
message
}
<
/SyntaxHighlighter> </
div
>
:
<
div
className
=
"message"
dangerouslySetInnerHTML
=
{{
__html
:
message
.
message
}}
/>
}
<
/div
>
<
/div
>
)
...
...
client/src/color_theme_1.css
View file @
2a5afc6
.chat-message.false
{
background
:
#eef2ff
;
}
section
::-webkit-scrollbar
{
display
:
none
;
}
.sidemenu
{
background-color
:
#101827
!important
;
}
...
...
@@ -37,6 +45,13 @@ span.info {
box-shadow
:
0px
7px
6px
-6px
black
!important
;
}
pre
{
font-family
:
monospace
,
monospace
;
font-size
:
1em
;
margin
:
0
;
padding
:
0
!important
;
}
.chat-message.chatgpt
{
background-color
:
#ffffff
!important
;
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment