|
|
@@ -63,12 +63,12 @@ export class ChatService {
|
|
|
}
|
|
|
|
|
|
public async chat1(req, res) {
|
|
|
- const user = this.chatPdfService.getUser(req.user.id)
|
|
|
+ const user = await this.chatPdfService.getUser(req.user.id)
|
|
|
res.setHeader('Content-type', 'application/octet-stream')
|
|
|
const defSysMsg = (await this.sysConfigService.findByName('system_message'))?.value
|
|
|
const membership = await this.membershipService.getMembership(req.user.id)
|
|
|
const { prompt, options = {}, systemMessage, code, temperature, top_p } = req.body as RequestProps
|
|
|
- if (!code) {
|
|
|
+ if (!user.apiUserId) {
|
|
|
if (!membership) {
|
|
|
throw new ForbiddenException('请先成为会员')
|
|
|
}
|
|
|
@@ -82,7 +82,7 @@ export class ChatService {
|
|
|
try {
|
|
|
let content = ''
|
|
|
const promptTime = new Date()
|
|
|
- if (!!(await user).apiUserId) {
|
|
|
+ if (!!user.apiUserId) {
|
|
|
content = await this.chatPdfService.getSystemConfig(req.user.id, prompt, code, code, systemMessage)
|
|
|
}
|
|
|
let firstChunk = true
|