Skip to content

Commit dd398b5

Browse files
committed
Fix archiving
1 parent 27c9cdc commit dd398b5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Tool/Sources/OpenAIService/ChatGPTService.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ extension ChatGPTService {
265265
requestBody
266266
)
267267

268+
#if DEBUG
268269
Debugger.didSendRequestBody(body: requestBody)
270+
#endif
269271

270272
return AsyncThrowingStream<StreamContent, Error> { continuation in
271273
Task {
@@ -376,7 +378,9 @@ extension ChatGPTService {
376378
requestBody
377379
)
378380

381+
#if DEBUG
379382
Debugger.didSendRequestBody(body: requestBody)
383+
#endif
380384

381385
let response = try await api()
382386

@@ -418,7 +422,9 @@ extension ChatGPTService {
418422
_ call: ChatMessage.FunctionCall,
419423
messageId: String? = nil
420424
) async -> String {
425+
#if DEBUG
421426
Debugger.didReceiveFunction(name: call.name, arguments: call.arguments)
427+
#endif
422428

423429
let messageId = messageId ?? uuidGenerator()
424430

@@ -445,7 +451,9 @@ extension ChatGPTService {
445451
}
446452
}
447453

454+
#if DEBUG
448455
Debugger.didReceiveFunctionResult(result: result.botReadableContent)
456+
#endif
449457

450458
await memory.updateMessage(id: messageId) { message in
451459
message.content = result.botReadableContent
@@ -456,7 +464,9 @@ extension ChatGPTService {
456464
// For errors, use the error message as the result.
457465
let content = "Error: \(error.localizedDescription)"
458466

467+
#if DEBUG
459468
Debugger.didReceiveFunctionResult(result: content)
469+
#endif
460470

461471
await memory.updateMessage(id: messageId) { message in
462472
message.content = content

0 commit comments

Comments
 (0)