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
21eeded6
authored
2023-02-02 07:03:48 +0000
by
Janis
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'fix_master_updated_ui' into '1DEVT'
fix_master_updated_ui See merge request
!4
2 parents
3f4efe8d
5fbcb51a
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
176 deletions
client/.gitignore
client/package-lock.json
client/package.json
client/src/App.css
client/src/App.js
client/src/SideMenu.js
index.js
client/.gitignore
View file @
21eeded
...
...
@@ -2,7 +2,6 @@
# dependencies
/node_modules
node_modules
/.pnp
.pnp.js
...
...
client/package-lock.json
View file @
21eeded
...
...
@@ -2996,9 +2996,9 @@
}
},
"@types/yargs"
:
{
"version"
:
"17.0.2
0
"
,
"resolved"
:
"https://registry.npmjs.org/@types/yargs/-/yargs-17.0.2
0
.tgz"
,
"integrity"
:
"sha512-
eknWrTHofQuPk2iuqDm1waA7V6xPlbgBoaaXEgYkClhLOnB0TtbW+srJaOToAgawPxPlHQzwypFA2bhZaUGP5A
=="
,
"version"
:
"17.0.2
2
"
,
"resolved"
:
"https://registry.npmjs.org/@types/yargs/-/yargs-17.0.2
2
.tgz"
,
"integrity"
:
"sha512-
pet5WJ9U8yPVRhkwuEIp5ktAeAqRZOq4UdAyWLWzxbtpyXnzbtLdKiXAjJzi/KLmPGS9wk86lUFWZFN6sISo4g
=="
,
"requires"
:
{
"@types/yargs-parser"
:
"*"
}
...
...
@@ -3009,14 +3009,15 @@
"integrity"
:
"sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA=="
},
"@typescript-eslint/eslint-plugin"
:
{
"version"
:
"5.
49
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.
49
.0.tgz"
,
"integrity"
:
"sha512-
IhxabIpcf++TBaBa1h7jtOWyon80SXPRLDq0dVz5SLFC/eW6tofkw/O7Ar3lkx5z5U6wzbKDrl2larprp5kk5
Q=="
,
"version"
:
"5.
50
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.
50
.0.tgz"
,
"integrity"
:
"sha512-
vwksQWSFZiUhgq3Kv7o1Jcj0DUNylwnIlGvKvLLYsq8pAWha6/WCnXUeaSoNNha/K7QSf2+jvmkxggC1u3pIw
Q=="
,
"requires"
:
{
"@typescript-eslint/scope-manager"
:
"5.
49
.0"
,
"@typescript-eslint/type-utils"
:
"5.
49
.0"
,
"@typescript-eslint/utils"
:
"5.
49
.0"
,
"@typescript-eslint/scope-manager"
:
"5.
50
.0"
,
"@typescript-eslint/type-utils"
:
"5.
50
.0"
,
"@typescript-eslint/utils"
:
"5.
50
.0"
,
"debug"
:
"^4.3.4"
,
"grapheme-splitter"
:
"^1.0.4"
,
"ignore"
:
"^5.2.0"
,
"natural-compare-lite"
:
"^1.4.0"
,
"regexpp"
:
"^3.2.0"
,
...
...
@@ -3025,56 +3026,56 @@
}
},
"@typescript-eslint/experimental-utils"
:
{
"version"
:
"5.
49
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.
49
.0.tgz"
,
"integrity"
:
"sha512-
veLpCJLYn44Fru7mSvi2doxQMzMCOFSDYdMUQhAzaH1vFYq2RVNpecZ8d18Wh6UMv07yahXkiv/aShWE48iE9Q
=="
,
"version"
:
"5.
50
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.
50
.0.tgz"
,
"integrity"
:
"sha512-
gZIhzNRivy0RVqcxjKnQ+ipGc0qolilhBeNmvH+Dvu7Vymug+IfiYxTj2zM7mIlHsw6Q5aH7L7WmuTE3tZyzag
=="
,
"requires"
:
{
"@typescript-eslint/utils"
:
"5.
49
.0"
"@typescript-eslint/utils"
:
"5.
50
.0"
}
},
"@typescript-eslint/parser"
:
{
"version"
:
"5.
49
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.
49
.0.tgz"
,
"integrity"
:
"sha512-
veDlZN9mUhGqU31Qiv2qEp+XrJj5fgZpJ8PW30sHU+j/8/e5ruAhLaVDAeznS7A7i4ucb/s8IozpDtt9NqCkZg
=="
,
"version"
:
"5.
50
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.
50
.0.tgz"
,
"integrity"
:
"sha512-
KCcSyNaogUDftK2G9RXfQyOCt51uB5yqC6pkUYqhYh8Kgt+DwR5M0EwEAxGPy/+DH6hnmKeGsNhiZRQxjH71uQ
=="
,
"requires"
:
{
"@typescript-eslint/scope-manager"
:
"5.
49
.0"
,
"@typescript-eslint/types"
:
"5.
49
.0"
,
"@typescript-eslint/typescript-estree"
:
"5.
49
.0"
,
"@typescript-eslint/scope-manager"
:
"5.
50
.0"
,
"@typescript-eslint/types"
:
"5.
50
.0"
,
"@typescript-eslint/typescript-estree"
:
"5.
50
.0"
,
"debug"
:
"^4.3.4"
}
},
"@typescript-eslint/scope-manager"
:
{
"version"
:
"5.
49
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.
49
.0.tgz"
,
"integrity"
:
"sha512-
clpROBOiMIzpbWNxCe1xDK14uPZh35u4QaZO1GddilEzoCLAEz4szb51rBpdgurs5k2YzPtJeTEN3qVbG+LRUQ
=="
,
"version"
:
"5.
50
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.
50
.0.tgz"
,
"integrity"
:
"sha512-
rt03kaX+iZrhssaT974BCmoUikYtZI24Vp/kwTSy841XhiYShlqoshRFDvN1FKKvU2S3gK+kcBW1EA7kNUrogg
=="
,
"requires"
:
{
"@typescript-eslint/types"
:
"5.
49
.0"
,
"@typescript-eslint/visitor-keys"
:
"5.
49
.0"
"@typescript-eslint/types"
:
"5.
50
.0"
,
"@typescript-eslint/visitor-keys"
:
"5.
50
.0"
}
},
"@typescript-eslint/type-utils"
:
{
"version"
:
"5.
49
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.
49
.0.tgz"
,
"integrity"
:
"sha512-
eUgLTYq0tR0FGU5g1YHm4rt5H/+V2IPVkP0cBmbhRyEmyGe4XvJ2YJ6sYTmONfjmdMqyMLad7SB8GvblbeESZA
=="
,
"version"
:
"5.
50
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.
50
.0.tgz"
,
"integrity"
:
"sha512-
dcnXfZ6OGrNCO7E5UY/i0ktHb7Yx1fV6fnQGGrlnfDhilcs6n19eIRcvLBqx6OQkrPaFlDPk3OJ0WlzQfrV0bQ
=="
,
"requires"
:
{
"@typescript-eslint/typescript-estree"
:
"5.
49
.0"
,
"@typescript-eslint/utils"
:
"5.
49
.0"
,
"@typescript-eslint/typescript-estree"
:
"5.
50
.0"
,
"@typescript-eslint/utils"
:
"5.
50
.0"
,
"debug"
:
"^4.3.4"
,
"tsutils"
:
"^3.21.0"
}
},
"@typescript-eslint/types"
:
{
"version"
:
"5.
49
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/types/-/types-5.
49
.0.tgz"
,
"integrity"
:
"sha512-
7If46kusG+sSnEpu0yOz2xFv5nRz158nzEXnJFCGVEHWnuzolXKwrH5Bsf9zsNlOQkyZuk0BZKKoJQI+1JPBBg
=="
"version"
:
"5.
50
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/types/-/types-5.
50
.0.tgz"
,
"integrity"
:
"sha512-
atruOuJpir4OtyNdKahiHZobPKFvZnBnfDiyEaBf6d9vy9visE7gDjlmhl+y29uxZ2ZDgvXijcungGFjGGex7w
=="
},
"@typescript-eslint/typescript-estree"
:
{
"version"
:
"5.
49
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.
49
.0.tgz"
,
"integrity"
:
"sha512-
PBdx+V7deZT/3GjNYPVQv1Nc0U46dAHbIuOG8AZ3on3vuEKiPDwFE/lG1snN2eUB9IhF7EyF7K1hmTcLztNIsA
=="
,
"version"
:
"5.
50
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.
50
.0.tgz"
,
"integrity"
:
"sha512-
Gq4zapso+OtIZlv8YNAStFtT6d05zyVCK7Fx3h5inlLBx2hWuc/0465C2mg/EQDDU2LKe52+/jN4f0g9bd+kow
=="
,
"requires"
:
{
"@typescript-eslint/types"
:
"5.
49
.0"
,
"@typescript-eslint/visitor-keys"
:
"5.
49
.0"
,
"@typescript-eslint/types"
:
"5.
50
.0"
,
"@typescript-eslint/visitor-keys"
:
"5.
50
.0"
,
"debug"
:
"^4.3.4"
,
"globby"
:
"^11.1.0"
,
"is-glob"
:
"^4.0.3"
,
...
...
@@ -3083,15 +3084,15 @@
}
},
"@typescript-eslint/utils"
:
{
"version"
:
"5.
49
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.
49
.0.tgz"
,
"integrity"
:
"sha512-
cPJue/4Si25FViIb74sHCLtM4nTSBXtLx1d3/QT6mirQ/c65bV8arBEebBJJizfq8W2YyMoPI/WWPFWitmNqnQ
=="
,
"version"
:
"5.
50
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.
50
.0.tgz"
,
"integrity"
:
"sha512-
v/AnUFImmh8G4PH0NDkf6wA8hujNNcrwtecqW4vtQ1UOSNBaZl49zP1SHoZ/06e+UiwzHpgb5zP5+hwlYYWYAw
=="
,
"requires"
:
{
"@types/json-schema"
:
"^7.0.9"
,
"@types/semver"
:
"^7.3.12"
,
"@typescript-eslint/scope-manager"
:
"5.
49
.0"
,
"@typescript-eslint/types"
:
"5.
49
.0"
,
"@typescript-eslint/typescript-estree"
:
"5.
49
.0"
,
"@typescript-eslint/scope-manager"
:
"5.
50
.0"
,
"@typescript-eslint/types"
:
"5.
50
.0"
,
"@typescript-eslint/typescript-estree"
:
"5.
50
.0"
,
"eslint-scope"
:
"^5.1.1"
,
"eslint-utils"
:
"^3.0.0"
,
"semver"
:
"^7.3.7"
...
...
@@ -3114,11 +3115,11 @@
}
},
"@typescript-eslint/visitor-keys"
:
{
"version"
:
"5.
49
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.
49
.0.tgz"
,
"integrity"
:
"sha512-
v9jBMjpNWyn8B6k/Mjt6VbUS4J1GvUlR4x3Y+ibnP1z7y7V4n0WRz+50DY6+Myj0UaXVSuUlHohO+eZ8IJEnk
g=="
,
"version"
:
"5.
50
.0"
,
"resolved"
:
"https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.
50
.0.tgz"
,
"integrity"
:
"sha512-
cdMeD9HGu6EXIeGOh2yVW6oGf9wq8asBgZx7nsR/D36gTfQ0odE5kcRYe5M81vjEFAcPeugXrHg78Imu55F6g
g=="
,
"requires"
:
{
"@typescript-eslint/types"
:
"5.
49
.0"
,
"@typescript-eslint/types"
:
"5.
50
.0"
,
"eslint-visitor-keys"
:
"^3.3.0"
}
},
...
...
@@ -3977,9 +3978,9 @@
}
},
"caniuse-lite"
:
{
"version"
:
"1.0.300014
49
"
,
"resolved"
:
"https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.300014
49
.tgz"
,
"integrity"
:
"sha512-
CPB+UL9XMT/Av+pJxCKGhdx+yg1hzplvFJQlJ2n68PyQGMz9L/E2zCyLdOL8uasbouTUgnPl+y0tccI/se+BE
w=="
"version"
:
"1.0.300014
50
"
,
"resolved"
:
"https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.300014
50
.tgz"
,
"integrity"
:
"sha512-
qMBmvmQmFXaSxexkjjfMvD5rnDL0+m+dUMZKoDYsGG8iZN29RuYh9eRoMvKsT6uMAWlyUUGDEQGJJYjzCIO9e
w=="
},
"case-sensitive-paths-webpack-plugin"
:
{
"version"
:
"2.4.0"
,
...
...
@@ -9145,9 +9146,9 @@
"integrity"
:
"sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw=="
},
"node-releases"
:
{
"version"
:
"2.0.
8
"
,
"resolved"
:
"https://registry.npmjs.org/node-releases/-/node-releases-2.0.
8
.tgz"
,
"integrity"
:
"sha512-
dFSmB8fFHEH/s81Xi+Y/15DQY6VHW81nXRj86EMSL3lmuTmK1e+aT4wrFCkTbm+gSwkw4KpX+rT/pMM2c1mF+
A=="
"version"
:
"2.0.
9
"
,
"resolved"
:
"https://registry.npmjs.org/node-releases/-/node-releases-2.0.
9
.tgz"
,
"integrity"
:
"sha512-
2xfmOrRkGogbTK9R6Leda0DGiXeY3p2NJpy4+gNCffdUvV6mdEJnaDEic1i3Ec2djAo8jWYoJMR5PB0MSMpxU
A=="
},
"normalize-path"
:
{
"version"
:
"3.0.0"
,
...
...
@@ -10512,11 +10513,6 @@
"resolved"
:
"https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz"
,
"integrity"
:
"sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
},
"react-openai-api"
:
{
"version"
:
"1.0.2"
,
"resolved"
:
"https://registry.npmjs.org/react-openai-api/-/react-openai-api-1.0.2.tgz"
,
"integrity"
:
"sha512-jpyVrBmZryD3QbFLIW+6ltTRZ3En9m+ypppXS/selyKJ8URElP0Z/0YGqYHZ/X6oX9ryQdq/W435Mv1afsWbgQ=="
},
"react-refresh"
:
{
"version"
:
"0.11.0"
,
"resolved"
:
"https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz"
,
...
...
@@ -11157,9 +11153,9 @@
"integrity"
:
"sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="
},
"shell-quote"
:
{
"version"
:
"1.
7.4
"
,
"resolved"
:
"https://registry.npmjs.org/shell-quote/-/shell-quote-1.
7.4
.tgz"
,
"integrity"
:
"sha512-
8o/QEhSSRb1a5i7TFR0iM4G16Z0vYB2OQVs4G3aAFXjn3T6yEx8AZxy1PgDF7I00LZHYA3WxaSYIf5e5sAX8Rw
=="
"version"
:
"1.
8.0
"
,
"resolved"
:
"https://registry.npmjs.org/shell-quote/-/shell-quote-1.
8.0
.tgz"
,
"integrity"
:
"sha512-
QHsz8GgQIGKlRi24yFc6a6lN69Idnx634w49ay6+jA5yFh7a1UY+4Rp6HPx/L/1zcEDPEij8cIsiqR6bQsE5VQ
=="
},
"side-channel"
:
{
"version"
:
"1.0.4"
,
...
...
@@ -11627,9 +11623,9 @@
}
},
"terser"
:
{
"version"
:
"5.16.
1
"
,
"resolved"
:
"https://registry.npmjs.org/terser/-/terser-5.16.
1
.tgz"
,
"integrity"
:
"sha512-
xvQfyfA1ayT0qdK47zskQgRZeWLoOQ8JQ6mIgRGVNwZKdQMU+5FkCBjmv4QjcrTzyZquRw2FVtlJSRUmMKQslw
=="
,
"version"
:
"5.16.
2
"
,
"resolved"
:
"https://registry.npmjs.org/terser/-/terser-5.16.
2
.tgz"
,
"integrity"
:
"sha512-
JKuM+KvvWVqT7muHVyrwv7FVRPnmHDwF6XwoIxdbF5Witi0vu99RYpxDexpJndXt3jbZZmmWr2/mQa6HvSNdSg
=="
,
"requires"
:
{
"@jridgewell/source-map"
:
"^0.3.2"
,
"acorn"
:
"^8.5.0"
,
...
...
client/package.json
View file @
21eeded
...
...
@@ -8,7 +8,6 @@
"@testing-library/user-event"
:
"^13.5.0"
,
"react"
:
"^18.2.0"
,
"react-dom"
:
"^18.2.0"
,
"react-openai-api"
:
"^1.0.2"
,
"react-scripts"
:
"5.0.1"
,
"web-vitals"
:
"^2.1.4"
},
...
...
client/src/App.css
View file @
21eeded
...
...
@@ -9,7 +9,7 @@
.sidemenu
{
width
:
260px
;
padding
:
10px
;
background-color
:
#202123
;
background-color
:
#202123
;
}
/* under 640px do this */
@media
(
max-width
:
640px
)
{
...
...
@@ -34,7 +34,6 @@
padding-right
:
12px
;
}
.chatbox
{
flex
:
1
;
background-color
:
#343541
;
...
...
@@ -59,17 +58,16 @@
position
:
absolute
;
bottom
:
0
;
left
:
0
;
right
:
0
;
background
:
rgb
(
57
57
57
);
}
.chat-input-textarea
{
background-color
:
#40414f
;
width
:
90%
;
padding
:
12px
;
border-radius
:
5px
;
color
:
#ffffff
;
font-size
:
1.25em
;
border
:
none
;
outline
:
none
;
background-color
:
#40414f
;
width
:
90%
;
padding
:
12px
;
border-radius
:
5px
;
color
:
white
;
font-size
:
1.25em
;
border
:
none
;
outline
:
none
;
box-shadow
:
0
0
8px
0
rgba
(
0
,
0
,
0
,
0.25
);
}
...
...
@@ -96,21 +94,20 @@
}
.chat-message.chatgpt
{
background-color
:
#
ffffff
;
background-color
:
#
444654
;
}
.chat-message-center
{
max-width
:
640px
;
margin-left
:
auto
;
margin-right
:
auto
;
display
:
flex
;
padding
:
12px
24px
;
}
padding
:
12px
;
padding-left
:
24px
;
padding-right
:
24px
;
section
::-webkit-scrollbar
{
display
:
none
;
}
.avatar
{
background
:
#ffffff
;
background
:
white
;
border-radius
:
50%
;
width
:
40px
;
height
:
40px
;
...
...
@@ -121,8 +118,6 @@ section::-webkit-scrollbar {
font-size
:
14px
;
color
:
#444654
;
}
.avatar.chatgpt
{
background
:
#0da37f
;
border-radius
:
50%
;
...
...
@@ -132,11 +127,8 @@ section::-webkit-scrollbar {
color
:
white
;
}
.message
{
padding
:
7px
20px
;
}
.chat-message.false
{
background
:
#eef2ff
;
padding-left
:
40px
;
padding-right
:
40px
;
}
@keyframes
App-logo-spin
{
...
...
@@ -150,18 +142,18 @@ section::-webkit-scrollbar {
.select-models
{
border
:
1px
solid
white
;
padding
:
12px
;
padding
:
12px
;
border-radius
:
5px
;
color
:
white
;
background
:
transparent
;
color
:
white
;
background
:
transparent
;
outline
:
none
;
cursor
:
pointer
;
max-width
:
100%
;
min-width
:
100%
;
}
.select-models
option
{
background
:
black
;
color
:
#ffffff
;
background
:
black
;
color
:
white
;
}
.button-picker
{
...
...
client/src/App.js
View file @
21eeded
...
...
@@ -4,7 +4,6 @@ import './color_theme_1.css';
import
{
useState
,
useEffect
}
from
'react'
;
import
SideMenu
from
'./SideMenu'
import
ChatBox
from
'./ChatBox'
import
OpenAIAPI
from
"react-openai-api"
;
function
App
()
{
...
...
@@ -14,7 +13,7 @@ function App() {
const
[
chatInput
,
setChatInput
]
=
useState
(
""
);
const
[
models
,
setModels
]
=
useState
([]);
const
[
temperature
,
setTemperature
]
=
useState
(
0.
5
);
const
[
temperature
,
setTemperature
]
=
useState
(
0.
7
);
const
[
currentModel
,
setCurrentModel
]
=
useState
(
"text-davinci-003"
);
const
[
chatLog
,
setChatLog
]
=
useState
([{
user
:
"gpt"
,
...
...
@@ -49,88 +48,29 @@ function App() {
// fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post
const
messages
=
chatLogNew
.
map
((
message
)
=>
message
.
message
).
join
(
"\n"
)
// const response = await fetch("http://localhost:3080/", {
// method: "POST",
// headers: {
// "Content-Type": "application/json"
// },
// body: JSON.stringify({
// message: messages,
// currentModel,
// })
// });
// const data = await response.json();
// setChatLog([...chatLogNew, { user: "gpt", message: `${data.message}`} ])
// var scrollToTheBottomChatLog = document.getElementsByClassName("chat-log")[0];
// scrollToTheBottomChatLog.scrollTop = scrollToTheBottomChatLog.scrollHeight;
var
oHttp
=
new
XMLHttpRequest
();
oHttp
.
open
(
"POST"
,
"https://api.openai.com/v1/completions"
);
oHttp
.
setRequestHeader
(
"Accept"
,
"application/json"
);
oHttp
.
setRequestHeader
(
"Content-Type"
,
"application/json"
);
oHttp
.
setRequestHeader
(
"Authorization"
,
"Bearer "
+
"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"
)
oHttp
.
onreadystatechange
=
function
()
{
if
(
oHttp
.
readyState
===
4
)
{
var
s
=
''
var
oJson
=
{}
if
(
s
!=
""
)
s
+=
"\n"
;
try
{
oJson
=
JSON
.
parse
(
oHttp
.
responseText
);
}
catch
(
ex
)
{
s
+=
"Error: "
+
ex
.
message
}
if
(
oJson
.
error
&&
oJson
.
error
.
message
)
{
s
+=
"Error: "
+
oJson
.
error
.
message
;
}
else
if
(
oJson
.
choices
&&
oJson
.
choices
[
0
].
text
)
{
s
=
oJson
.
choices
[
0
].
text
;
var
a
=
s
.
split
(
"?\n"
);
if
(
a
.
length
==
2
)
{
s
=
a
[
1
];
}
// if (selLang.value != "en-US") {
// var a = s.split("?\n");
// if (a.length == 2) {
// s = a[1];
// }
// }
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
sModel
=
currentModel
;
// "text-davinci-003";
var
iMaxTokens
=
100
;
var
sUserId
=
"1"
;
var
dTemperature
=
temperature
;
var
data
=
{
model
:
sModel
,
prompt
:
messages
,
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.
//stop: ["#", ";"] //Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
}
oHttp
.
send
(
JSON
.
stringify
(
data
));;
const
response
=
await
fetch
(
"http://localhost:3080/"
,
{
method
:
"POST"
,
headers
:
{
"Content-Type"
:
"application/json"
},
body
:
JSON
.
stringify
({
message
:
messages
,
currentModel
,
})
});
const
data
=
await
response
.
json
();
setChatLog
([...
chatLogNew
,
{
user
:
"gpt"
,
message
:
`
${
data
.
message
}
`
}
])
var
scrollToTheBottomChatLog
=
document
.
getElementsByClassName
(
"chat-log"
)[
0
];
scrollToTheBottomChatLog
.
scrollTop
=
scrollToTheBottomChatLog
.
scrollHeight
;
}
function
handleTemp
(
temp
)
{
if
(
temp
>
1
){
//
setTemperature(1)
setTemperature
(
1
)
}
else
if
(
temp
<
0
){
//
setTemperature(0)
setTemperature
(
0
)
}
else
{
//
setTemperature(temp)
setTemperature
(
temp
)
}
}
...
...
client/src/SideMenu.js
View file @
21eeded
...
...
@@ -57,7 +57,7 @@ const SideMenu = ({ clearChat, currentModel, setCurrentModel, models, setTempera
The
temperature
parameter
controls
the
randomness
of
the
model
.
0
is
the
most
logical
,
1
is
the
most
creative
.
<
/span
>
<
/div
>
<
/aside
>
<
/aside
>
const
Button
=
({
onClick
,
text
})
=>
<
div
...
...
index.js
View file @
21eeded
...
...
@@ -5,8 +5,8 @@ const cors = require('cors')
// Open AI Configuration
const
configuration
=
new
Configuration
({
organization
:
"org-2OIAoj4fSwE4RCzgvglUM55T
"
,
apiKey
:
"sk-
1xewNAjRfv4CEvITa8drT3BlbkFJ2tGsl88fFYnijhyNcm3k
"
,
organization
:
"org-organization
"
,
apiKey
:
"sk-
apiKey
"
,
});
const
openai
=
new
OpenAIApi
(
configuration
);
...
...
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