You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AnalyticsView - I call the function try await vm.analyseWeek()
AnswersAnalyticsVM:
private let api = ChatGPTAPI(apiKey: Constants.Keys.chatgpt)
private let gptModel = "gpt-3.5-turbo"
func analyseWeek() async throws {
do {
let weekAnswers = try await collectAllWeekAnswers() // Fetching the data to input ChatGPT
let analysisString = try await api.sendMessage(text: weekAnswers, model: gptModel)
if let userid = await Session.shared.user_id {
// Saving output to DB
} else {
throw CustomError.sessionError
}
} catch let err{
throw err
}
}
App crashes when I call api.sendMessage() with the message "Swift/RangeReplaceableCollection.swift:622: Fatal error: Can't remove first element from an empty collection".
AnalyticsView - I call the function
try await vm.analyseWeek()
AnswersAnalyticsVM:
App crashes when I call api.sendMessage() with the message "Swift/RangeReplaceableCollection.swift:622: Fatal error: Can't remove first element from an empty collection".
XCode crash trickle-down:
private func json```
Body(text: String, model: String, systemText: String, temperature: Double, stream: Bool = true) throws -> Data {
let request = Request(model: model,
temperature: temperature,
messages: generateMessages(from: text, systemText: systemText),
stream: stream) // Here
return try JSONEncoder().encode(request)
}
Why does it happen? I think it's a bug.
The text was updated successfully, but these errors were encountered: