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
a978d3f7
authored
2023-04-17 06:40:25 +0000
by
Ryan
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch '27190_loggedin' into 'master'
27190_loggedin See merge request
!53
2 parents
8df6621a
68aee7cc
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
1 deletions
client/public/index.html
client/src/App.js
client/src/index.css
client/public/index.html
View file @
a978d3f
...
...
@@ -26,6 +26,33 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>
AI-Pro ChatGPT
</title>
<script
src=
'%REACT_APP_BTCOMPONENT_S3_URL%/common/btutil-authenticate.min.js'
></script>
<script>
let
aiUser
=
btutil_getCookie
(
'aiwp_logged_in'
);
if
(
!
aiUser
)
{
window
.
location
.
href
=
'%REACT_APP_AUTH_FAILED_REDIRECTION_URL%'
;
}
else
{
let
objBody
=
{
aiwp_logged_in
:
aiUser
};
let
params
=
[];
params
[
'objBody'
]
=
objBody
;
params
[
'strUrl'
]
=
'%REACT_APP_EXTERNAL_API_URL%/e/v1/authenticate/'
;
btutil_checkAuthentication
(
params
,
cbCheckAuthentication
,
cbErrCheckAuthentication
);
function
cbCheckAuthentication
(
res
)
{
// console.log(res);
if
(
!
res
.
success
)
{
window
.
location
.
href
=
'%REACT_APP_AUTH_FAILED_REDIRECTION_URL%'
;
}
else
{
document
.
getElementById
(
"root"
).
classList
.
add
(
"active"
);
}
}
function
cbErrCheckAuthentication
(
res
)
{
console
.
log
(
res
);
}
}
</script>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
...
...
client/src/App.js
View file @
a978d3f
...
...
@@ -57,7 +57,28 @@ function App() {
async
function
handleSubmit
(
e
){
e
.
preventDefault
();
let
aiUser
=
window
.
btutil_getCookie
(
'aiwp_logged_in'
);
if
(
!
aiUser
)
{
window
.
location
.
href
=
process
.
env
.
REACT_APP_AUTH_FAILED_REDIRECTION_URL
;
return
;
}
else
{
let
objBody
=
{
aiwp_logged_in
:
aiUser
};
let
params
=
[];
params
[
'objBody'
]
=
objBody
;
params
[
'strUrl'
]
=
process
.
env
.
REACT_APP_EXTERNAL_API_URL
+
'/e/v1/authenticate/'
;
window
.
btutil_checkAuthentication
(
params
,
function
(
res
)
{
if
(
!
res
.
success
)
{
window
.
location
.
href
=
process
.
env
.
REACT_APP_AUTH_FAILED_REDIRECTION_URL
;
}
else
{
submitPrompt
();
}
},
function
(
res
)
{});
}
}
async
function
submitPrompt
()
{
const
userInput
=
[
'what'
,
'why'
,
'when'
,
'where'
,
'which'
,
'did'
,
'do'
,
'how'
,
'can'
,
'are'
,
'who'
];
const
userInputRegex
=
new
RegExp
(
`\\b(
${
userInput
.
join
(
'|'
)}
)\\b`
,
'gi'
);
const
inputMatches
=
chatInput
.
match
(
userInputRegex
);
...
...
@@ -91,7 +112,6 @@ function App() {
messages
=
JSON
.
stringify
(
chatLogTurboNew
);
}
let
intervalId
=
startInterval
();
try
{
const
response
=
await
fetch
(
process
.
env
.
REACT_APP_SERVER_URL
+
"/api"
,
{
method
:
"POST"
,
...
...
client/src/index.css
View file @
a978d3f
...
...
@@ -11,3 +11,7 @@ code {
font-family
:
source-code-pro
,
Menlo
,
Monaco
,
Consolas
,
'Courier New'
,
monospace
;
}
#root
:not
(
.active
)
{
display
:
none
;
}
\ No newline at end of file
...
...
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