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
7efe8cd6
Commit
7efe8cd6
authored
Feb 21, 2023
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fallback to davinci if keys are there
parent
c8541e7c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
src/chatgpt/chatgpt.service.ts
src/chatgpt/chatgpt.service.ts
+4
-1
src/davinci/davinci.service.ts
src/davinci/davinci.service.ts
+9
-0
No files found.
src/chatgpt/chatgpt.service.ts
View file @
7efe8cd6
...
...
@@ -30,7 +30,10 @@ export class ChatgptService extends ConsoleLogger {
previousConversation
?.
account
,
failedAccounts
,
);
if
(
!
account
)
{
if
(
!
account
||
(
failedAccounts
.
length
>
1
&&
(
await
this
.
davinciService
.
isAvailable
()))
)
{
/*throw new BlankReturnMessageDto(
500,
'No available accounts',
...
...
src/davinci/davinci.service.ts
View file @
7efe8cd6
...
...
@@ -16,6 +16,15 @@ export class DavinciService extends ConsoleLogger implements OnModuleInit {
this
.
ChatGPTApiConstructor
=
ChatGPTAPI
;
}
private
_isAvailable
=
false
;
async
isAvailable
()
{
if
(
this
.
_isAvailable
)
return
true
;
const
keys
=
await
this
.
keyProvider
.
get
();
if
(
!
keys
.
length
)
return
false
;
this
.
_isAvailable
=
true
;
return
true
;
}
private
pointer
=
0
;
private
async
getKey
(
exclude
:
string
[]
=
[])
{
const
excludeSet
=
new
Set
(
exclude
);
...
...
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