Skip to content

Commit b8198e1

Browse files
committed
fix: add check for all the queryllm
1 parent feb8dbe commit b8198e1

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

services/libs/common_services/src/services/llm.service.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ export class LlmService extends LoggerBase {
158158
): Promise<ILlmResult<LlmMemberEnrichmentResult>> {
159159
const response = await this.queryLlm(LlmQueryType.MEMBER_ENRICHMENT, prompt, memberId)
160160

161+
if (!response) {
162+
return {
163+
result: null,
164+
} as ILlmResult<LlmMemberEnrichmentResult>
165+
}
166+
161167
const result = JSON.parse(response.answer)
162168

163169
return {
@@ -175,6 +181,12 @@ export class LlmService extends LoggerBase {
175181
memberId,
176182
)
177183

184+
if (!response) {
185+
return {
186+
result: null,
187+
} as ILlmResult<{ profileIndex: number }>
188+
}
189+
178190
const result = JSON.parse(response.answer)
179191

180192
return {
@@ -193,6 +205,12 @@ export class LlmService extends LoggerBase {
193205
memberId,
194206
)
195207

208+
if (!response) {
209+
return {
210+
result: null,
211+
} as ILlmResult<T>
212+
}
213+
196214
const result = JSON.parse(response.answer)
197215

198216
return {
@@ -211,6 +229,12 @@ export class LlmService extends LoggerBase {
211229
memberId,
212230
)
213231

232+
if (!response) {
233+
return {
234+
result: null,
235+
} as ILlmResult<T>
236+
}
237+
214238
const result = JSON.parse(response.answer)
215239

216240
return {

0 commit comments

Comments
 (0)