Merge branch '26903_chatgpt_output_error' into 'master'
26903 chatgpt output error See merge request !12
Showing
16 changed files
with
284 additions
and
186 deletions
README.md
0 → 100644
| 1 | # ChatGPT Server | ||
| 2 | |||
| 3 | ## Installation | ||
| 4 | |||
| 5 | npm install on the root directory. | ||
| 6 | |||
| 7 | ## Create ENV Variables | ||
| 8 | |||
| 9 | Create an .env file in the root directory of your application. | ||
| 10 | Duplicate the env-template and rename to .env | ||
| 11 | In the .env file, define the environment variables you want to use in your application. ex. | ||
| 12 | |||
| 13 | `API_KEY="sk-xxxxxxxx"` | ||
| 14 | `API_ORG="org-xxxxxxx"` | ||
| 15 | |||
| 16 | ## Run server | ||
| 17 | |||
| 18 | Run server on the root directory | ||
| 19 | |||
| 20 | `node index.js` | ||
| 21 | |||
| 22 | ### Additional Configuration | ||
| 23 | |||
| 24 | After running server, proceed to /client README.md for instructions | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -2,7 +2,6 @@ | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | ||
| 3 | # dependencies | 3 | # dependencies |
| 4 | /node_modules | 4 | /node_modules |
| 5 | node_modules | ||
| 6 | /.pnp | 5 | /.pnp |
| 7 | .pnp.js | 6 | .pnp.js |
| 8 | 7 | ||
| ... | @@ -14,6 +13,7 @@ node_modules | ... | @@ -14,6 +13,7 @@ node_modules |
| 14 | 13 | ||
| 15 | # misc | 14 | # misc |
| 16 | .DS_Store | 15 | .DS_Store |
| 16 | .env | ||
| 17 | .env.local | 17 | .env.local |
| 18 | .env.development.local | 18 | .env.development.local |
| 19 | .env.test.local | 19 | .env.test.local | ... | ... |
| 1 | # ChatGPT Client | ||
| 1 | # Getting Started with Create React App | 2 | # Getting Started with Create React App |
| 2 | |||
| 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). |
| 4 | 4 | ||
| 5 | ## Installation | ||
| 6 | |||
| 7 | npm install on the /client directory. | ||
| 8 | |||
| 9 | |||
| 10 | ## Create ENV Variables | ||
| 11 | |||
| 12 | Create an .env file in the /client directory of your application. | ||
| 13 | Duplicate the env-template and rename to .env | ||
| 14 | In the .env file, define the environment variables you want to use in your application. ex. | ||
| 15 | |||
| 16 | REACT_APP_SERVER_URL=http://xxxxxx/ | ||
| 17 | |||
| 5 | ## Available Scripts | 18 | ## Available Scripts |
| 6 | 19 | ||
| 7 | In the project directory, you can run: | 20 | In the /client directory, you can run: |
| 8 | 21 | ||
| 9 | ### `npm start` | 22 | ### `npm start` |
| 10 | 23 | ... | ... |
client/env-template
0 → 100644
| 1 | REACT_APP_SERVER_URL= | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -2996,9 +2996,9 @@ | ... | @@ -2996,9 +2996,9 @@ |
| 2996 | } | 2996 | } |
| 2997 | }, | 2997 | }, |
| 2998 | "@types/yargs": { | 2998 | "@types/yargs": { |
| 2999 | "version": "17.0.20", | 2999 | "version": "17.0.22", |
| 3000 | "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.20.tgz", | 3000 | "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz", |
| 3001 | "integrity": "sha512-eknWrTHofQuPk2iuqDm1waA7V6xPlbgBoaaXEgYkClhLOnB0TtbW+srJaOToAgawPxPlHQzwypFA2bhZaUGP5A==", | 3001 | "integrity": "sha512-pet5WJ9U8yPVRhkwuEIp5ktAeAqRZOq4UdAyWLWzxbtpyXnzbtLdKiXAjJzi/KLmPGS9wk86lUFWZFN6sISo4g==", |
| 3002 | "requires": { | 3002 | "requires": { |
| 3003 | "@types/yargs-parser": "*" | 3003 | "@types/yargs-parser": "*" |
| 3004 | } | 3004 | } |
| ... | @@ -3009,14 +3009,15 @@ | ... | @@ -3009,14 +3009,15 @@ |
| 3009 | "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" | 3009 | "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" |
| 3010 | }, | 3010 | }, |
| 3011 | "@typescript-eslint/eslint-plugin": { | 3011 | "@typescript-eslint/eslint-plugin": { |
| 3012 | "version": "5.49.0", | 3012 | "version": "5.50.0", |
| 3013 | "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.49.0.tgz", | 3013 | "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.50.0.tgz", |
| 3014 | "integrity": "sha512-IhxabIpcf++TBaBa1h7jtOWyon80SXPRLDq0dVz5SLFC/eW6tofkw/O7Ar3lkx5z5U6wzbKDrl2larprp5kk5Q==", | 3014 | "integrity": "sha512-vwksQWSFZiUhgq3Kv7o1Jcj0DUNylwnIlGvKvLLYsq8pAWha6/WCnXUeaSoNNha/K7QSf2+jvmkxggC1u3pIwQ==", |
| 3015 | "requires": { | 3015 | "requires": { |
| 3016 | "@typescript-eslint/scope-manager": "5.49.0", | 3016 | "@typescript-eslint/scope-manager": "5.50.0", |
| 3017 | "@typescript-eslint/type-utils": "5.49.0", | 3017 | "@typescript-eslint/type-utils": "5.50.0", |
| 3018 | "@typescript-eslint/utils": "5.49.0", | 3018 | "@typescript-eslint/utils": "5.50.0", |
| 3019 | "debug": "^4.3.4", | 3019 | "debug": "^4.3.4", |
| 3020 | "grapheme-splitter": "^1.0.4", | ||
| 3020 | "ignore": "^5.2.0", | 3021 | "ignore": "^5.2.0", |
| 3021 | "natural-compare-lite": "^1.4.0", | 3022 | "natural-compare-lite": "^1.4.0", |
| 3022 | "regexpp": "^3.2.0", | 3023 | "regexpp": "^3.2.0", |
| ... | @@ -3025,56 +3026,56 @@ | ... | @@ -3025,56 +3026,56 @@ |
| 3025 | } | 3026 | } |
| 3026 | }, | 3027 | }, |
| 3027 | "@typescript-eslint/experimental-utils": { | 3028 | "@typescript-eslint/experimental-utils": { |
| 3028 | "version": "5.49.0", | 3029 | "version": "5.50.0", |
| 3029 | "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.49.0.tgz", | 3030 | "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.50.0.tgz", |
| 3030 | "integrity": "sha512-veLpCJLYn44Fru7mSvi2doxQMzMCOFSDYdMUQhAzaH1vFYq2RVNpecZ8d18Wh6UMv07yahXkiv/aShWE48iE9Q==", | 3031 | "integrity": "sha512-gZIhzNRivy0RVqcxjKnQ+ipGc0qolilhBeNmvH+Dvu7Vymug+IfiYxTj2zM7mIlHsw6Q5aH7L7WmuTE3tZyzag==", |
| 3031 | "requires": { | 3032 | "requires": { |
| 3032 | "@typescript-eslint/utils": "5.49.0" | 3033 | "@typescript-eslint/utils": "5.50.0" |
| 3033 | } | 3034 | } |
| 3034 | }, | 3035 | }, |
| 3035 | "@typescript-eslint/parser": { | 3036 | "@typescript-eslint/parser": { |
| 3036 | "version": "5.49.0", | 3037 | "version": "5.50.0", |
| 3037 | "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.49.0.tgz", | 3038 | "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.50.0.tgz", |
| 3038 | "integrity": "sha512-veDlZN9mUhGqU31Qiv2qEp+XrJj5fgZpJ8PW30sHU+j/8/e5ruAhLaVDAeznS7A7i4ucb/s8IozpDtt9NqCkZg==", | 3039 | "integrity": "sha512-KCcSyNaogUDftK2G9RXfQyOCt51uB5yqC6pkUYqhYh8Kgt+DwR5M0EwEAxGPy/+DH6hnmKeGsNhiZRQxjH71uQ==", |
| 3039 | "requires": { | 3040 | "requires": { |
| 3040 | "@typescript-eslint/scope-manager": "5.49.0", | 3041 | "@typescript-eslint/scope-manager": "5.50.0", |
| 3041 | "@typescript-eslint/types": "5.49.0", | 3042 | "@typescript-eslint/types": "5.50.0", |
| 3042 | "@typescript-eslint/typescript-estree": "5.49.0", | 3043 | "@typescript-eslint/typescript-estree": "5.50.0", |
| 3043 | "debug": "^4.3.4" | 3044 | "debug": "^4.3.4" |
| 3044 | } | 3045 | } |
| 3045 | }, | 3046 | }, |
| 3046 | "@typescript-eslint/scope-manager": { | 3047 | "@typescript-eslint/scope-manager": { |
| 3047 | "version": "5.49.0", | 3048 | "version": "5.50.0", |
| 3048 | "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.49.0.tgz", | 3049 | "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.50.0.tgz", |
| 3049 | "integrity": "sha512-clpROBOiMIzpbWNxCe1xDK14uPZh35u4QaZO1GddilEzoCLAEz4szb51rBpdgurs5k2YzPtJeTEN3qVbG+LRUQ==", | 3050 | "integrity": "sha512-rt03kaX+iZrhssaT974BCmoUikYtZI24Vp/kwTSy841XhiYShlqoshRFDvN1FKKvU2S3gK+kcBW1EA7kNUrogg==", |
| 3050 | "requires": { | 3051 | "requires": { |
| 3051 | "@typescript-eslint/types": "5.49.0", | 3052 | "@typescript-eslint/types": "5.50.0", |
| 3052 | "@typescript-eslint/visitor-keys": "5.49.0" | 3053 | "@typescript-eslint/visitor-keys": "5.50.0" |
| 3053 | } | 3054 | } |
| 3054 | }, | 3055 | }, |
| 3055 | "@typescript-eslint/type-utils": { | 3056 | "@typescript-eslint/type-utils": { |
| 3056 | "version": "5.49.0", | 3057 | "version": "5.50.0", |
| 3057 | "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.49.0.tgz", | 3058 | "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.50.0.tgz", |
| 3058 | "integrity": "sha512-eUgLTYq0tR0FGU5g1YHm4rt5H/+V2IPVkP0cBmbhRyEmyGe4XvJ2YJ6sYTmONfjmdMqyMLad7SB8GvblbeESZA==", | 3059 | "integrity": "sha512-dcnXfZ6OGrNCO7E5UY/i0ktHb7Yx1fV6fnQGGrlnfDhilcs6n19eIRcvLBqx6OQkrPaFlDPk3OJ0WlzQfrV0bQ==", |
| 3059 | "requires": { | 3060 | "requires": { |
| 3060 | "@typescript-eslint/typescript-estree": "5.49.0", | 3061 | "@typescript-eslint/typescript-estree": "5.50.0", |
| 3061 | "@typescript-eslint/utils": "5.49.0", | 3062 | "@typescript-eslint/utils": "5.50.0", |
| 3062 | "debug": "^4.3.4", | 3063 | "debug": "^4.3.4", |
| 3063 | "tsutils": "^3.21.0" | 3064 | "tsutils": "^3.21.0" |
| 3064 | } | 3065 | } |
| 3065 | }, | 3066 | }, |
| 3066 | "@typescript-eslint/types": { | 3067 | "@typescript-eslint/types": { |
| 3067 | "version": "5.49.0", | 3068 | "version": "5.50.0", |
| 3068 | "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.49.0.tgz", | 3069 | "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.50.0.tgz", |
| 3069 | "integrity": "sha512-7If46kusG+sSnEpu0yOz2xFv5nRz158nzEXnJFCGVEHWnuzolXKwrH5Bsf9zsNlOQkyZuk0BZKKoJQI+1JPBBg==" | 3070 | "integrity": "sha512-atruOuJpir4OtyNdKahiHZobPKFvZnBnfDiyEaBf6d9vy9visE7gDjlmhl+y29uxZ2ZDgvXijcungGFjGGex7w==" |
| 3070 | }, | 3071 | }, |
| 3071 | "@typescript-eslint/typescript-estree": { | 3072 | "@typescript-eslint/typescript-estree": { |
| 3072 | "version": "5.49.0", | 3073 | "version": "5.50.0", |
| 3073 | "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.49.0.tgz", | 3074 | "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.50.0.tgz", |
| 3074 | "integrity": "sha512-PBdx+V7deZT/3GjNYPVQv1Nc0U46dAHbIuOG8AZ3on3vuEKiPDwFE/lG1snN2eUB9IhF7EyF7K1hmTcLztNIsA==", | 3075 | "integrity": "sha512-Gq4zapso+OtIZlv8YNAStFtT6d05zyVCK7Fx3h5inlLBx2hWuc/0465C2mg/EQDDU2LKe52+/jN4f0g9bd+kow==", |
| 3075 | "requires": { | 3076 | "requires": { |
| 3076 | "@typescript-eslint/types": "5.49.0", | 3077 | "@typescript-eslint/types": "5.50.0", |
| 3077 | "@typescript-eslint/visitor-keys": "5.49.0", | 3078 | "@typescript-eslint/visitor-keys": "5.50.0", |
| 3078 | "debug": "^4.3.4", | 3079 | "debug": "^4.3.4", |
| 3079 | "globby": "^11.1.0", | 3080 | "globby": "^11.1.0", |
| 3080 | "is-glob": "^4.0.3", | 3081 | "is-glob": "^4.0.3", |
| ... | @@ -3083,15 +3084,15 @@ | ... | @@ -3083,15 +3084,15 @@ |
| 3083 | } | 3084 | } |
| 3084 | }, | 3085 | }, |
| 3085 | "@typescript-eslint/utils": { | 3086 | "@typescript-eslint/utils": { |
| 3086 | "version": "5.49.0", | 3087 | "version": "5.50.0", |
| 3087 | "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.49.0.tgz", | 3088 | "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.50.0.tgz", |
| 3088 | "integrity": "sha512-cPJue/4Si25FViIb74sHCLtM4nTSBXtLx1d3/QT6mirQ/c65bV8arBEebBJJizfq8W2YyMoPI/WWPFWitmNqnQ==", | 3089 | "integrity": "sha512-v/AnUFImmh8G4PH0NDkf6wA8hujNNcrwtecqW4vtQ1UOSNBaZl49zP1SHoZ/06e+UiwzHpgb5zP5+hwlYYWYAw==", |
| 3089 | "requires": { | 3090 | "requires": { |
| 3090 | "@types/json-schema": "^7.0.9", | 3091 | "@types/json-schema": "^7.0.9", |
| 3091 | "@types/semver": "^7.3.12", | 3092 | "@types/semver": "^7.3.12", |
| 3092 | "@typescript-eslint/scope-manager": "5.49.0", | 3093 | "@typescript-eslint/scope-manager": "5.50.0", |
| 3093 | "@typescript-eslint/types": "5.49.0", | 3094 | "@typescript-eslint/types": "5.50.0", |
| 3094 | "@typescript-eslint/typescript-estree": "5.49.0", | 3095 | "@typescript-eslint/typescript-estree": "5.50.0", |
| 3095 | "eslint-scope": "^5.1.1", | 3096 | "eslint-scope": "^5.1.1", |
| 3096 | "eslint-utils": "^3.0.0", | 3097 | "eslint-utils": "^3.0.0", |
| 3097 | "semver": "^7.3.7" | 3098 | "semver": "^7.3.7" |
| ... | @@ -3114,11 +3115,11 @@ | ... | @@ -3114,11 +3115,11 @@ |
| 3114 | } | 3115 | } |
| 3115 | }, | 3116 | }, |
| 3116 | "@typescript-eslint/visitor-keys": { | 3117 | "@typescript-eslint/visitor-keys": { |
| 3117 | "version": "5.49.0", | 3118 | "version": "5.50.0", |
| 3118 | "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.49.0.tgz", | 3119 | "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.50.0.tgz", |
| 3119 | "integrity": "sha512-v9jBMjpNWyn8B6k/Mjt6VbUS4J1GvUlR4x3Y+ibnP1z7y7V4n0WRz+50DY6+Myj0UaXVSuUlHohO+eZ8IJEnkg==", | 3120 | "integrity": "sha512-cdMeD9HGu6EXIeGOh2yVW6oGf9wq8asBgZx7nsR/D36gTfQ0odE5kcRYe5M81vjEFAcPeugXrHg78Imu55F6gg==", |
| 3120 | "requires": { | 3121 | "requires": { |
| 3121 | "@typescript-eslint/types": "5.49.0", | 3122 | "@typescript-eslint/types": "5.50.0", |
| 3122 | "eslint-visitor-keys": "^3.3.0" | 3123 | "eslint-visitor-keys": "^3.3.0" |
| 3123 | } | 3124 | } |
| 3124 | }, | 3125 | }, |
| ... | @@ -3977,9 +3978,9 @@ | ... | @@ -3977,9 +3978,9 @@ |
| 3977 | } | 3978 | } |
| 3978 | }, | 3979 | }, |
| 3979 | "caniuse-lite": { | 3980 | "caniuse-lite": { |
| 3980 | "version": "1.0.30001449", | 3981 | "version": "1.0.30001450", |
| 3981 | "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001449.tgz", | 3982 | "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001450.tgz", |
| 3982 | "integrity": "sha512-CPB+UL9XMT/Av+pJxCKGhdx+yg1hzplvFJQlJ2n68PyQGMz9L/E2zCyLdOL8uasbouTUgnPl+y0tccI/se+BEw==" | 3983 | "integrity": "sha512-qMBmvmQmFXaSxexkjjfMvD5rnDL0+m+dUMZKoDYsGG8iZN29RuYh9eRoMvKsT6uMAWlyUUGDEQGJJYjzCIO9ew==" |
| 3983 | }, | 3984 | }, |
| 3984 | "case-sensitive-paths-webpack-plugin": { | 3985 | "case-sensitive-paths-webpack-plugin": { |
| 3985 | "version": "2.4.0", | 3986 | "version": "2.4.0", |
| ... | @@ -9145,9 +9146,9 @@ | ... | @@ -9145,9 +9146,9 @@ |
| 9145 | "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==" | 9146 | "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==" |
| 9146 | }, | 9147 | }, |
| 9147 | "node-releases": { | 9148 | "node-releases": { |
| 9148 | "version": "2.0.8", | 9149 | "version": "2.0.9", |
| 9149 | "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.8.tgz", | 9150 | "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.9.tgz", |
| 9150 | "integrity": "sha512-dFSmB8fFHEH/s81Xi+Y/15DQY6VHW81nXRj86EMSL3lmuTmK1e+aT4wrFCkTbm+gSwkw4KpX+rT/pMM2c1mF+A==" | 9151 | "integrity": "sha512-2xfmOrRkGogbTK9R6Leda0DGiXeY3p2NJpy4+gNCffdUvV6mdEJnaDEic1i3Ec2djAo8jWYoJMR5PB0MSMpxUA==" |
| 9151 | }, | 9152 | }, |
| 9152 | "normalize-path": { | 9153 | "normalize-path": { |
| 9153 | "version": "3.0.0", | 9154 | "version": "3.0.0", |
| ... | @@ -10512,11 +10513,6 @@ | ... | @@ -10512,11 +10513,6 @@ |
| 10512 | "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", | 10513 | "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", |
| 10513 | "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" | 10514 | "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" |
| 10514 | }, | 10515 | }, |
| 10515 | "react-openai-api": { | ||
| 10516 | "version": "1.0.2", | ||
| 10517 | "resolved": "https://registry.npmjs.org/react-openai-api/-/react-openai-api-1.0.2.tgz", | ||
| 10518 | "integrity": "sha512-jpyVrBmZryD3QbFLIW+6ltTRZ3En9m+ypppXS/selyKJ8URElP0Z/0YGqYHZ/X6oX9ryQdq/W435Mv1afsWbgQ==" | ||
| 10519 | }, | ||
| 10520 | "react-refresh": { | 10516 | "react-refresh": { |
| 10521 | "version": "0.11.0", | 10517 | "version": "0.11.0", |
| 10522 | "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", | 10518 | "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", |
| ... | @@ -11157,9 +11153,9 @@ | ... | @@ -11157,9 +11153,9 @@ |
| 11157 | "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" | 11153 | "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" |
| 11158 | }, | 11154 | }, |
| 11159 | "shell-quote": { | 11155 | "shell-quote": { |
| 11160 | "version": "1.7.4", | 11156 | "version": "1.8.0", |
| 11161 | "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.4.tgz", | 11157 | "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.0.tgz", |
| 11162 | "integrity": "sha512-8o/QEhSSRb1a5i7TFR0iM4G16Z0vYB2OQVs4G3aAFXjn3T6yEx8AZxy1PgDF7I00LZHYA3WxaSYIf5e5sAX8Rw==" | 11158 | "integrity": "sha512-QHsz8GgQIGKlRi24yFc6a6lN69Idnx634w49ay6+jA5yFh7a1UY+4Rp6HPx/L/1zcEDPEij8cIsiqR6bQsE5VQ==" |
| 11163 | }, | 11159 | }, |
| 11164 | "side-channel": { | 11160 | "side-channel": { |
| 11165 | "version": "1.0.4", | 11161 | "version": "1.0.4", |
| ... | @@ -11627,9 +11623,9 @@ | ... | @@ -11627,9 +11623,9 @@ |
| 11627 | } | 11623 | } |
| 11628 | }, | 11624 | }, |
| 11629 | "terser": { | 11625 | "terser": { |
| 11630 | "version": "5.16.1", | 11626 | "version": "5.16.2", |
| 11631 | "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.1.tgz", | 11627 | "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.2.tgz", |
| 11632 | "integrity": "sha512-xvQfyfA1ayT0qdK47zskQgRZeWLoOQ8JQ6mIgRGVNwZKdQMU+5FkCBjmv4QjcrTzyZquRw2FVtlJSRUmMKQslw==", | 11628 | "integrity": "sha512-JKuM+KvvWVqT7muHVyrwv7FVRPnmHDwF6XwoIxdbF5Witi0vu99RYpxDexpJndXt3jbZZmmWr2/mQa6HvSNdSg==", |
| 11633 | "requires": { | 11629 | "requires": { |
| 11634 | "@jridgewell/source-map": "^0.3.2", | 11630 | "@jridgewell/source-map": "^0.3.2", |
| 11635 | "acorn": "^8.5.0", | 11631 | "acorn": "^8.5.0", | ... | ... |
| ... | @@ -8,7 +8,6 @@ | ... | @@ -8,7 +8,6 @@ |
| 8 | "@testing-library/user-event": "^13.5.0", | 8 | "@testing-library/user-event": "^13.5.0", |
| 9 | "react": "^18.2.0", | 9 | "react": "^18.2.0", |
| 10 | "react-dom": "^18.2.0", | 10 | "react-dom": "^18.2.0", |
| 11 | "react-openai-api": "^1.0.2", | ||
| 12 | "react-scripts": "5.0.1", | 11 | "react-scripts": "5.0.1", |
| 13 | "web-vitals": "^2.1.4" | 12 | "web-vitals": "^2.1.4" |
| 14 | }, | 13 | }, | ... | ... |
| ... | @@ -9,7 +9,7 @@ | ... | @@ -9,7 +9,7 @@ |
| 9 | .sidemenu { | 9 | .sidemenu { |
| 10 | width:260px; | 10 | width:260px; |
| 11 | padding:10px; | 11 | padding:10px; |
| 12 | background-color: #202123; | 12 | background-color:#202123; |
| 13 | } | 13 | } |
| 14 | /* under 640px do this */ | 14 | /* under 640px do this */ |
| 15 | @media (max-width: 640px) { | 15 | @media (max-width: 640px) { |
| ... | @@ -34,7 +34,6 @@ | ... | @@ -34,7 +34,6 @@ |
| 34 | padding-right:12px; | 34 | padding-right:12px; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | |||
| 38 | .chatbox { | 37 | .chatbox { |
| 39 | flex:1; | 38 | flex:1; |
| 40 | background-color:#343541; | 39 | background-color:#343541; |
| ... | @@ -59,17 +58,16 @@ | ... | @@ -59,17 +58,16 @@ |
| 59 | position:absolute; | 58 | position:absolute; |
| 60 | bottom:0; | 59 | bottom:0; |
| 61 | left:0;right:0; | 60 | left:0;right:0; |
| 62 | background: rgb(57 57 57); | ||
| 63 | } | 61 | } |
| 64 | .chat-input-textarea { | 62 | .chat-input-textarea { |
| 65 | background-color: #40414f; | 63 | background-color:#40414f; |
| 66 | width: 90%; | 64 | width:90%; |
| 67 | padding: 12px; | 65 | padding:12px; |
| 68 | border-radius: 5px; | 66 | border-radius:5px; |
| 69 | color: #ffffff; | 67 | color:white; |
| 70 | font-size: 1.25em; | 68 | font-size:1.25em; |
| 71 | border: none; | 69 | border:none; |
| 72 | outline: none; | 70 | outline:none; |
| 73 | box-shadow: 0 0 8px 0 rgba(0,0,0,0.25); | 71 | box-shadow: 0 0 8px 0 rgba(0,0,0,0.25); |
| 74 | } | 72 | } |
| 75 | 73 | ||
| ... | @@ -96,21 +94,20 @@ | ... | @@ -96,21 +94,20 @@ |
| 96 | } | 94 | } |
| 97 | 95 | ||
| 98 | .chat-message.chatgpt { | 96 | .chat-message.chatgpt { |
| 99 | background-color:#ffffff; | 97 | background-color:#444654; |
| 100 | } | 98 | } |
| 101 | .chat-message-center { | 99 | .chat-message-center { |
| 102 | max-width:640px; | 100 | max-width:640px; |
| 103 | margin-left:auto; | 101 | margin-left:auto; |
| 104 | margin-right:auto; | 102 | margin-right:auto; |
| 105 | display:flex; | 103 | display:flex; |
| 106 | padding: 12px 24px; | 104 | padding:12px; |
| 107 | } | 105 | padding-left: 24px; |
| 106 | padding-right: 24px; | ||
| 108 | 107 | ||
| 109 | section::-webkit-scrollbar { | ||
| 110 | display: none; | ||
| 111 | } | 108 | } |
| 112 | .avatar { | 109 | .avatar { |
| 113 | background:#ffffff; | 110 | background:white; |
| 114 | border-radius:50%; | 111 | border-radius:50%; |
| 115 | width: 40px; | 112 | width: 40px; |
| 116 | height: 40px; | 113 | height: 40px; |
| ... | @@ -121,8 +118,6 @@ section::-webkit-scrollbar { | ... | @@ -121,8 +118,6 @@ section::-webkit-scrollbar { |
| 121 | font-size:14px; | 118 | font-size:14px; |
| 122 | color:#444654; | 119 | color:#444654; |
| 123 | } | 120 | } |
| 124 | |||
| 125 | |||
| 126 | .avatar.chatgpt { | 121 | .avatar.chatgpt { |
| 127 | background:#0da37f; | 122 | background:#0da37f; |
| 128 | border-radius:50%; | 123 | border-radius:50%; |
| ... | @@ -132,11 +127,8 @@ section::-webkit-scrollbar { | ... | @@ -132,11 +127,8 @@ section::-webkit-scrollbar { |
| 132 | color:white; | 127 | color:white; |
| 133 | } | 128 | } |
| 134 | .message { | 129 | .message { |
| 135 | padding: 7px 20px; | 130 | padding-left: 40px; |
| 136 | } | 131 | padding-right: 40px; |
| 137 | |||
| 138 | .chat-message.false { | ||
| 139 | background: #eef2ff; | ||
| 140 | } | 132 | } |
| 141 | 133 | ||
| 142 | @keyframes App-logo-spin { | 134 | @keyframes App-logo-spin { |
| ... | @@ -150,18 +142,18 @@ section::-webkit-scrollbar { | ... | @@ -150,18 +142,18 @@ section::-webkit-scrollbar { |
| 150 | 142 | ||
| 151 | .select-models { | 143 | .select-models { |
| 152 | border: 1px solid white; | 144 | border: 1px solid white; |
| 153 | padding: 12px; | 145 | padding:12px; |
| 154 | border-radius:5px; | 146 | border-radius:5px; |
| 155 | color: white; | 147 | color:white; |
| 156 | background: transparent; | 148 | background:transparent; |
| 157 | outline:none; | 149 | outline:none; |
| 158 | cursor:pointer; | 150 | cursor:pointer; |
| 159 | max-width:100%; | 151 | max-width:100%; |
| 160 | min-width:100%; | 152 | min-width:100%; |
| 161 | } | 153 | } |
| 162 | .select-models option { | 154 | .select-models option { |
| 163 | background: black; | 155 | background:black; |
| 164 | color: #ffffff; | 156 | color:white; |
| 165 | } | 157 | } |
| 166 | 158 | ||
| 167 | .button-picker { | 159 | .button-picker { | ... | ... |
| ... | @@ -4,7 +4,6 @@ import './color_theme_1.css'; | ... | @@ -4,7 +4,6 @@ import './color_theme_1.css'; |
| 4 | import { useState, useEffect } from 'react'; | 4 | import { useState, useEffect } from 'react'; |
| 5 | import SideMenu from './SideMenu' | 5 | import SideMenu from './SideMenu' |
| 6 | import ChatBox from './ChatBox' | 6 | import ChatBox from './ChatBox' |
| 7 | import OpenAIAPI from "react-openai-api"; | ||
| 8 | 7 | ||
| 9 | function App() { | 8 | function App() { |
| 10 | 9 | ||
| ... | @@ -14,7 +13,7 @@ function App() { | ... | @@ -14,7 +13,7 @@ function App() { |
| 14 | 13 | ||
| 15 | const [chatInput, setChatInput] = useState(""); | 14 | const [chatInput, setChatInput] = useState(""); |
| 16 | const [models, setModels] = useState([]); | 15 | const [models, setModels] = useState([]); |
| 17 | const [temperature, setTemperature] = useState(0.5); | 16 | const [temperature, setTemperature] = useState(0.7); |
| 18 | const [currentModel, setCurrentModel] = useState("text-davinci-003"); | 17 | const [currentModel, setCurrentModel] = useState("text-davinci-003"); |
| 19 | const [chatLog, setChatLog] = useState([{ | 18 | const [chatLog, setChatLog] = useState([{ |
| 20 | user: "gpt", | 19 | user: "gpt", |
| ... | @@ -27,10 +26,10 @@ function App() { | ... | @@ -27,10 +26,10 @@ function App() { |
| 27 | } | 26 | } |
| 28 | 27 | ||
| 29 | function getEngines(){ | 28 | function getEngines(){ |
| 30 | fetch("http://localhost:3080/models") | 29 | fetch(process.env.REACT_APP_SERVER_URL + "/models") |
| 31 | .then(res => res.json()) | 30 | .then(res => res.json()) |
| 32 | .then(data => { | 31 | .then(data => { |
| 33 | console.log(data.models.data) | 32 | // console.log(data.models.data) |
| 34 | // set models in order alpahbetically | 33 | // set models in order alpahbetically |
| 35 | data.models.data.sort((a, b) => { | 34 | data.models.data.sort((a, b) => { |
| 36 | if(a.id < b.id) { return -1; } | 35 | if(a.id < b.id) { return -1; } |
| ... | @@ -43,94 +42,76 @@ function App() { | ... | @@ -43,94 +42,76 @@ function App() { |
| 43 | 42 | ||
| 44 | async function handleSubmit(e){ | 43 | async function handleSubmit(e){ |
| 45 | e.preventDefault(); | 44 | e.preventDefault(); |
| 46 | let chatLogNew = [...chatLog, { user: "me", message: `${chatInput}`} ] | 45 | // console.log(chatInput) |
| 46 | const userInput = ['what', 'why', 'when', 'where' , 'which', 'did', 'do', 'how', 'can', 'are', 'who', 'hey']; | ||
| 47 | const userInputRegex = new RegExp(`\\b(${userInput.join('|')})\\b`, 'gi'); | ||
| 48 | const inputMatches = chatInput.match(userInputRegex); | ||
| 49 | |||
| 50 | const userPunctuation = ['.', '?', '!', ':', ';', ',']; | ||
| 51 | const userPunctuationRegex = new RegExp(`${userPunctuation.join('')}$`, 'gi'); | ||
| 52 | const punctuationMatches = chatInput.match(userPunctuationRegex); | ||
| 53 | |||
| 54 | // console.log(punctuationMatches) | ||
| 55 | var userModifiedInput = chatInput | ||
| 56 | |||
| 57 | if (!punctuationMatches) { | ||
| 58 | if (!inputMatches) { | ||
| 59 | userModifiedInput = chatInput + "."; | ||
| 60 | // console.log("not a question!") | ||
| 61 | } else { | ||
| 62 | userModifiedInput = chatInput + "?"; | ||
| 63 | // console.log("its a question!") | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | let chatLogNew = [...chatLog, { user: "me", message: `${userModifiedInput}`} ] | ||
| 47 | setChatInput(""); | 68 | setChatInput(""); |
| 48 | setChatLog(chatLogNew) | 69 | setChatLog(chatLogNew) |
| 70 | |||
| 49 | // fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post | 71 | // fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post |
| 50 | const messages = chatLogNew.map((message) => message.message).join("\n") | 72 | const messages = chatLogNew.map((message) => message.message).join("\n") |
| 51 | 73 | ||
| 52 | 74 | const response = await fetch(process.env.REACT_APP_SERVER_URL + "/api", { | |
| 53 | // const response = await fetch("http://localhost:3080/", { | 75 | method: "POST", |
| 54 | // method: "POST", | 76 | headers: { |
| 55 | // headers: { | 77 | "Content-Type": "application/json" |
| 56 | // "Content-Type": "application/json" | 78 | }, |
| 57 | // }, | 79 | body: JSON.stringify({ |
| 58 | // body: JSON.stringify({ | 80 | message: messages, |
| 59 | // message: messages, | 81 | currentModel, |
| 60 | // currentModel, | 82 | }) |
| 61 | // }) | 83 | }); |
| 62 | // }); | 84 | const data = await response.json(); |
| 63 | // const data = await response.json(); | 85 | const parsedData = data.message.trim(); |
| 64 | // setChatLog([...chatLogNew, { user: "gpt", message: `${data.message}`} ]) | 86 | // console.log(parsedData) |
| 65 | // var scrollToTheBottomChatLog = document.getElementsByClassName("chat-log")[0]; | 87 | const programmingKeywords = ['code', 'application', 'controller', 'rails' , 'PHP', 'java', 'javascript', 'script', 'console', 'python', 'programming', 'table']; |
| 66 | // scrollToTheBottomChatLog.scrollTop = scrollToTheBottomChatLog.scrollHeight; | 88 | |
| 67 | 89 | const regex = new RegExp(`\\b(${programmingKeywords.join('|')})\\b`, 'gi'); | |
| 68 | var oHttp = new XMLHttpRequest(); | 90 | // console.log(regex) |
| 69 | oHttp.open("POST", "https://api.openai.com/v1/completions"); | 91 | const matches = parsedData.match(regex); |
| 70 | oHttp.setRequestHeader("Accept", "application/json"); | 92 | // console.log(matches); |
| 71 | oHttp.setRequestHeader("Content-Type", "application/json"); | 93 | if (!matches) { |
| 72 | oHttp.setRequestHeader("Authorization", "Bearer " + "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") | 94 | var replaceTags = (parsedData.replace(/(?:\r\n|\r|\n)/g, '<br>').replace(/\./g, '. ')) |
| 73 | 95 | // console.log("not programming!") | |
| 74 | oHttp.onreadystatechange = function () { | 96 | } else { |
| 75 | if (oHttp.readyState === 4) { | 97 | replaceTags = (parsedData.replace(':',':<code>').replace('<?','<?').replace('?>','?>').replace(/\n/g, '<br>')) |
| 76 | var s = '' | 98 | // console.log("programming!") |
| 77 | var oJson = {} | 99 | //.replace('<?','<' + '?').replace('?>','?'+'>') |
| 78 | if (s != "") s += "\n"; | ||
| 79 | try { | ||
| 80 | oJson = JSON.parse(oHttp.responseText); | ||
| 81 | } catch (ex) { | ||
| 82 | s += "Error: " + ex.message | ||
| 83 | } | ||
| 84 | if (oJson.error && oJson.error.message) { | ||
| 85 | s += "Error: " + oJson.error.message; | ||
| 86 | } else if (oJson.choices && oJson.choices[0].text) { | ||
| 87 | s = oJson.choices[0].text; | ||
| 88 | var a = s.split("?\n"); | ||
| 89 | if (a.length == 2) { | ||
| 90 | s = a[1]; | ||
| 91 | } | ||
| 92 | // if (selLang.value != "en-US") { | ||
| 93 | // var a = s.split("?\n"); | ||
| 94 | // if (a.length == 2) { | ||
| 95 | // s = a[1]; | ||
| 96 | // } | ||
| 97 | // } | ||
| 98 | if (s == "") s = "No response"; | ||
| 99 | console.log('ssssssssssssssssssssss',s); | ||
| 100 | var replaceBR= (s.replace(/(?:\r\n|\r|\n)/g, "<br>")).replace(/\r?\n|\r/, ""); | ||
| 101 | |||
| 102 | setChatLog([...chatLogNew, { user: "gpt", message: `${replaceBR}`} ]); | ||
| 103 | } | ||
| 104 | } | ||
| 105 | }; | ||
| 106 | |||
| 107 | var sModel = currentModel;// "text-davinci-003"; | ||
| 108 | var iMaxTokens = 100; | ||
| 109 | var sUserId = "1"; | ||
| 110 | var dTemperature =temperature; | ||
| 111 | |||
| 112 | var data = { | ||
| 113 | model: sModel, | ||
| 114 | prompt: messages, | ||
| 115 | max_tokens: iMaxTokens, | ||
| 116 | //user: sUserId, | ||
| 117 | temperature: dTemperature, | ||
| 118 | // frequency_penalty: 0.0, //Number between -2.0 and 2.0 Positive value decrease the model's likelihood to repeat the same line verbatim. | ||
| 119 | //presence_penalty: 0.0, //Number between -2.0 and 2.0. Positive values increase the model's likelihood to talk about new topics. | ||
| 120 | //stop: ["#", ";"] //Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. | ||
| 121 | } | 100 | } |
| 101 | setChatLog([...chatLogNew, { user: "gpt", message: `${replaceTags}`} ]) | ||
| 122 | 102 | ||
| 123 | oHttp.send(JSON.stringify(data));; | 103 | // setChatLog([...chatLogNew, { user: "gpt", message: `<div>${parsedData}</div>`} ]) |
| 124 | 104 | var scrollToTheBottomChatLog = document.getElementsByClassName("chat-log")[0]; | |
| 105 | scrollToTheBottomChatLog.scrollTop = scrollToTheBottomChatLog.scrollHeight; | ||
| 125 | } | 106 | } |
| 126 | 107 | ||
| 127 | function handleTemp(temp) { | 108 | function handleTemp(temp) { |
| 128 | if(temp > 1){ | 109 | if(temp > 1){ |
| 129 | // setTemperature(1) | 110 | setTemperature(1) |
| 130 | } else if (temp < 0){ | 111 | } else if (temp < 0){ |
| 131 | // setTemperature(0) | 112 | setTemperature(0) |
| 132 | } else { | 113 | } else { |
| 133 | // setTemperature(temp) | 114 | setTemperature(temp) |
| 134 | } | 115 | } |
| 135 | 116 | ||
| 136 | } | 117 | } | ... | ... |
| 1 | import OpenAISVGLogo from './OpenAISVGLogo' | 1 | // import OpenAISVGLogo from './OpenAISVGLogo' |
| 2 | 2 | ||
| 3 | // Primary Chat Window | 3 | // Primary Chat Window |
| 4 | const ChatBox = ({chatLog, setChatInput, handleSubmit, chatInput}) => | 4 | const ChatBox = ({chatLog, setChatInput, handleSubmit, chatInput}) => |
| ... | @@ -26,7 +26,7 @@ const ChatMessage = ({ message }) => { | ... | @@ -26,7 +26,7 @@ const ChatMessage = ({ message }) => { |
| 26 | <div className={`chat-message ${message.user === "gpt" && "chatgpt"}`}> | 26 | <div className={`chat-message ${message.user === "gpt" && "chatgpt"}`}> |
| 27 | <div className="chat-message-center"> | 27 | <div className="chat-message-center"> |
| 28 | <div className={`avatar ${message.user === "gpt" && "chatgpt"}`}> | 28 | <div className={`avatar ${message.user === "gpt" && "chatgpt"}`}> |
| 29 | {message.user === "gpt" ? <img className="ai-logo" src="../assets/images/bot.png" width="30px"/> : <img className="ai-logo" src="../assets/images/user.svg" />} | 29 | {message.user === "gpt" ? <img className="ai-logo" alt="Ai-pro bot" src="../assets/images/bot.png" width="30px"/> : <img className="ai-logo" alt="Ai-pro user" src="../assets/images/user.svg" />} |
| 30 | </div> | 30 | </div> |
| 31 | {/* <div className="message"> | 31 | {/* <div className="message"> |
| 32 | {message.message} | 32 | {message.message} | ... | ... |
| 1 | const SideMenu = ({ clearChat, currentModel, setCurrentModel, models, setTemperature, temperature }) => | 1 | const SideMenu = ({ clearChat, currentModel, setCurrentModel, models, setTemperature, temperature }) => |
| 2 | <aside className="sidemenu"> | 2 | <aside className="sidemenu"> |
| 3 | <div className="ai-logo-container"> | 3 | <div className="ai-logo-container"> |
| 4 | <img className="ai-logo" src="../assets/images/AIPRO-WHITE.png" height="50px"/> | 4 | <img className="ai-logo" alt="Ai-pro logo" src="../assets/images/AIPRO-WHITE.png" height="50px"/> |
| 5 | </div> | 5 | </div> |
| 6 | <div className="side-menu-button" onClick={clearChat}> | 6 | <div className="side-menu-button" onClick={clearChat}> |
| 7 | <span>+</span> | 7 | <span>+</span> |
| ... | @@ -57,7 +57,7 @@ const SideMenu = ({ clearChat, currentModel, setCurrentModel, models, setTempera | ... | @@ -57,7 +57,7 @@ const SideMenu = ({ clearChat, currentModel, setCurrentModel, models, setTempera |
| 57 | The temperature parameter controls the randomness of the model. 0 is the most logical, 1 is the most creative. | 57 | The temperature parameter controls the randomness of the model. 0 is the most logical, 1 is the most creative. |
| 58 | </span> | 58 | </span> |
| 59 | </div> | 59 | </div> |
| 60 | </aside> | 60 | </aside> |
| 61 | 61 | ||
| 62 | const Button = ({ onClick, text }) => | 62 | const Button = ({ onClick, text }) => |
| 63 | <div | 63 | <div | ... | ... |
| ... | @@ -35,13 +35,19 @@ span.info { | ... | @@ -35,13 +35,19 @@ span.info { |
| 35 | color: #101827 !important; | 35 | color: #101827 !important; |
| 36 | font-size: 16px !important; | 36 | font-size: 16px !important; |
| 37 | box-shadow: 0px 7px 6px -6px black !important; | 37 | box-shadow: 0px 7px 6px -6px black !important; |
| 38 | height: 45px; | ||
| 38 | } | 39 | } |
| 39 | 40 | ||
| 40 | .chat-message.chatgpt { | 41 | .chat-message.chatgpt { |
| 41 | background-color:#ffffff !important; | 42 | background: #feffff; /* Old browsers */ |
| 43 | background: -moz-linear-gradient(45deg, #feffff 0%, #ddf1f9 55%, #eff7f5 98%); /* FF3.6-15 */ | ||
| 44 | background: -webkit-linear-gradient(45deg, #feffff 0%,#ddf1f9 55%,#eff7f5 98%); /* Chrome10-25,Safari5.1-6 */ | ||
| 45 | background: linear-gradient(45deg, #feffff 0%,#ddf1f9 55%,#eff7f5 98%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ | ||
| 46 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#feffff', endColorstr='#eff7f5',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */ | ||
| 42 | } | 47 | } |
| 43 | .chat-message-center { | 48 | .chat-message-center { |
| 44 | padding: 20px 10px !important; | 49 | padding: 20px 10vw !important; |
| 50 | max-width: none; | ||
| 45 | } | 51 | } |
| 46 | 52 | ||
| 47 | .avatar { | 53 | .avatar { |
| ... | @@ -56,6 +62,34 @@ span.info { | ... | @@ -56,6 +62,34 @@ span.info { |
| 56 | border-radius:5px !important; | 62 | border-radius:5px !important; |
| 57 | box-shadow: 0px 5px 5px -3px black !important; | 63 | box-shadow: 0px 5px 5px -3px black !important; |
| 58 | } | 64 | } |
| 65 | |||
| 66 | .chat-log::-webkit-scrollbar{ | ||
| 67 | /*display: none;*/ | ||
| 68 | } | ||
| 69 | |||
| 70 | /* Let's get this party started */ | ||
| 71 | .chat-log::-webkit-scrollbar { | ||
| 72 | width: 8px; | ||
| 73 | } | ||
| 74 | |||
| 75 | /* Track */ | ||
| 76 | .chat-log::-webkit-scrollbar-track { | ||
| 77 | /*-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);*/ | ||
| 78 | -webkit-border-radius: 0px; | ||
| 79 | border-radius: 0px; | ||
| 80 | } | ||
| 81 | |||
| 82 | /* Handle */ | ||
| 83 | .chat-log::-webkit-scrollbar-thumb { | ||
| 84 | -webkit-border-radius: 10px; | ||
| 85 | border-radius: 10px; | ||
| 86 | background: #cccccc; | ||
| 87 | -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); | ||
| 88 | } | ||
| 89 | .chat-log::-webkit-scrollbar-thumb:window-inactive { | ||
| 90 | background: #eeeeee; | ||
| 91 | } | ||
| 92 | |||
| 59 | .message { | 93 | .message { |
| 60 | padding: 7px 20px !important; | 94 | padding: 7px 20px !important; |
| 61 | line-height: 25px; | 95 | line-height: 25px; |
| ... | @@ -99,3 +133,49 @@ span.info { | ... | @@ -99,3 +133,49 @@ span.info { |
| 99 | text-align: center; | 133 | text-align: center; |
| 100 | padding: 10px 0; | 134 | padding: 10px 0; |
| 101 | } | 135 | } |
| 136 | |||
| 137 | .message code { | ||
| 138 | background: #303030; | ||
| 139 | width: 100%; | ||
| 140 | color: #fff; | ||
| 141 | padding: 15px 20px; | ||
| 142 | border-radius: 10px; | ||
| 143 | font-family: monospace, sans-serif; | ||
| 144 | font-size: 12px; | ||
| 145 | display: block; | ||
| 146 | margin: 15px 5px; | ||
| 147 | } | ||
| 148 | |||
| 149 | code br:nth-child(-n+2) { | ||
| 150 | display: none; | ||
| 151 | } | ||
| 152 | |||
| 153 | @media (min-width: 1280px) { | ||
| 154 | .message { | ||
| 155 | font-size: 18px; | ||
| 156 | } | ||
| 157 | } | ||
| 158 | |||
| 159 | @media (max-width: 1279px) { | ||
| 160 | .message { | ||
| 161 | font-size: 16px; | ||
| 162 | } | ||
| 163 | } | ||
| 164 | |||
| 165 | @media (max-width: 991px) { | ||
| 166 | .message { | ||
| 167 | font-size: 14px; | ||
| 168 | } | ||
| 169 | .chat-message-center { | ||
| 170 | padding: 20px 5vw !important; | ||
| 171 | } | ||
| 172 | } | ||
| 173 | |||
| 174 | @media (max-width: 414px) { | ||
| 175 | .message { | ||
| 176 | font-size: 14px; | ||
| 177 | } | ||
| 178 | .chat-message-center { | ||
| 179 | padding: 20px 5vw !important; | ||
| 180 | } | ||
| 181 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
env-template
0 → 100644
| ... | @@ -2,11 +2,13 @@ const { Configuration, OpenAIApi } = require("openai"); | ... | @@ -2,11 +2,13 @@ const { Configuration, OpenAIApi } = require("openai"); |
| 2 | const express = require('express') | 2 | const express = require('express') |
| 3 | const bodyParser = require('body-parser') | 3 | const bodyParser = require('body-parser') |
| 4 | const cors = require('cors') | 4 | const cors = require('cors') |
| 5 | require('dotenv').config() | ||
| 5 | 6 | ||
| 6 | // Open AI Configuration | 7 | // Open AI Configuration |
| 8 | // console.log(process.env.OPENAI_API_ORG) | ||
| 7 | const configuration = new Configuration({ | 9 | const configuration = new Configuration({ |
| 8 | organization: "org-2OIAoj4fSwE4RCzgvglUM55T", | 10 | organization: process.env.OPENAI_API_ORG, |
| 9 | apiKey: "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", | 11 | apiKey: process.env.OPENAI_API_KEY, |
| 10 | }); | 12 | }); |
| 11 | const openai = new OpenAIApi(configuration); | 13 | const openai = new OpenAIApi(configuration); |
| 12 | 14 | ||
| ... | @@ -22,14 +24,15 @@ app.use(require('morgan')('dev')) | ... | @@ -22,14 +24,15 @@ app.use(require('morgan')('dev')) |
| 22 | // Routing | 24 | // Routing |
| 23 | 25 | ||
| 24 | // Primary Open AI Route | 26 | // Primary Open AI Route |
| 25 | app.post('/', async (req, res) => { | 27 | app.post('/api', async (req, res) => { |
| 26 | const { message, currentModel, temperature } = req.body; | 28 | const { message, currentModel, temperature } = req.body; |
| 27 | const response = await openai.createCompletion({ | 29 | const response = await openai.createCompletion({ |
| 28 | model: `${currentModel}`,// "text-davinci-003", | 30 | model: `${currentModel}`,// "text-davinci-003", |
| 29 | prompt: `${message}`, | 31 | prompt: `${message}`, |
| 30 | max_tokens: 100, | 32 | max_tokens: 2500, |
| 31 | temperature, | 33 | temperature, |
| 32 | }); | 34 | }); |
| 35 | |||
| 33 | res.json({ | 36 | res.json({ |
| 34 | message: response.data.choices[0].text, | 37 | message: response.data.choices[0].text, |
| 35 | }) | 38 | }) | ... | ... |
| ... | @@ -142,6 +142,11 @@ | ... | @@ -142,6 +142,11 @@ |
| 142 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", | 142 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", |
| 143 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" | 143 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" |
| 144 | }, | 144 | }, |
| 145 | "dotenv": { | ||
| 146 | "version": "16.0.3", | ||
| 147 | "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", | ||
| 148 | "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==" | ||
| 149 | }, | ||
| 145 | "ee-first": { | 150 | "ee-first": { |
| 146 | "version": "1.1.1", | 151 | "version": "1.1.1", |
| 147 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", | 152 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", | ... | ... |
| ... | @@ -11,6 +11,7 @@ | ... | @@ -11,6 +11,7 @@ |
| 11 | "dependencies": { | 11 | "dependencies": { |
| 12 | "body-parser": "^1.20.1", | 12 | "body-parser": "^1.20.1", |
| 13 | "cors": "^2.8.5", | 13 | "cors": "^2.8.5", |
| 14 | "dotenv": "^16.0.3", | ||
| 14 | "express": "^4.18.2", | 15 | "express": "^4.18.2", |
| 15 | "morgan": "^1.10.0", | 16 | "morgan": "^1.10.0", |
| 16 | "openai": "^3.1.0" | 17 | "openai": "^3.1.0" | ... | ... |
-
Please register or sign in to post a comment