Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Chatgpt Forwarder
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Chatgpt Forwarder
Commits
b2c925c3
"...Irrlicht/svn:/svn.code.sf.net/p/irrlicht/code/trunk@4138" did not exist on "008a470fd0c6e5a71b7eeb97c233a35baa507c8c"
Commit
b2c925c3
authored
Feb 12, 2023
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix new conversation
parent
55738829
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
src/chatgpt/chatgpt.service.ts
src/chatgpt/chatgpt.service.ts
+8
-4
src/conversation/conversation.dto.ts
src/conversation/conversation.dto.ts
+3
-0
No files found.
src/chatgpt/chatgpt.service.ts
View file @
b2c925c3
...
...
@@ -28,6 +28,9 @@ export class ChatgptService extends ConsoleLogger {
previousConversation
?.
account
,
failedAccounts
,
);
const
isNewConversation
=
!
previousConversation
||
account
.
getEmail
()
!==
previousConversation
.
account
;
if
(
!
account
)
{
throw
new
BlankReturnMessageDto
(
500
,
...
...
@@ -36,12 +39,12 @@ export class ChatgptService extends ConsoleLogger {
}
this
.
log
(
`Processing chat for
${
session
}
with
${
account
.
getEmail
()}
`
);
const
result
=
await
account
.
sendMessage
(
question
.
text
,
{
...(
previousConversation
?
{
...(
isNewConversation
?
{}
:
{
conversationId
:
previousConversation
.
conversationId
,
parentMessageId
:
previousConversation
.
messageId
,
}
:
{}),
}),
timeoutMs
:
300000
,
});
if
(
!
result
)
{
...
...
@@ -57,6 +60,7 @@ export class ChatgptService extends ConsoleLogger {
);
const
dto
=
new
ConversationDto
();
dto
.
session
=
session
;
dto
.
isNewConversation
=
isNewConversation
;
dto
.
text
=
result
.
response
.
replace
(
/^<!--
(
.*
)
-->$/gm
,
''
);
return
dto
;
}
...
...
src/conversation/conversation.dto.ts
View file @
b2c925c3
...
...
@@ -9,6 +9,9 @@ export class ConversationBase {
export
class
ConversationDto
extends
ConversationBase
{
@
ApiProperty
({
description
:
'
Message from ChatGPT.
'
})
text
:
string
;
@
ApiProperty
({
description
:
'
Whether the conversation is newly created.
'
})
isNewConversation
:
boolean
;
}
export
class
ConversationStorage
extends
ConversationBase
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment