Bug gixes, features added, GUI updates and more

This commit is contained in:
2026-02-12 14:29:35 +01:00
parent 52447b5e17
commit 7265d22438
21 changed files with 2187 additions and 123 deletions

View File

@@ -0,0 +1,35 @@
//
// HistoryEntry.swift
// oAI
//
// Command history entry model
//
import Foundation
struct HistoryEntry: Identifiable, Equatable {
let id = UUID()
let input: String
let timestamp: Date
/// Format timestamp in European format (dd.MM.yyyy HH:mm:ss)
var formattedDate: String {
let formatter = DateFormatter()
formatter.dateFormat = "dd.MM.yyyy HH:mm:ss"
return formatter.string(from: timestamp)
}
/// Short date without time (dd.MM.yyyy)
var shortDate: String {
let formatter = DateFormatter()
formatter.dateFormat = "dd.MM.yyyy"
return formatter.string(from: timestamp)
}
/// Just the time (HH:mm:ss)
var timeOnly: String {
let formatter = DateFormatter()
formatter.dateFormat = "HH:mm:ss"
return formatter.string(from: timestamp)
}
}

View File

@@ -21,7 +21,9 @@ struct Message: Identifiable, Codable, Equatable {
var cost: Double?
let timestamp: Date
let attachments: [FileAttachment]?
var responseTime: TimeInterval? // Time taken to generate response in seconds
var wasInterrupted: Bool = false // Whether generation was cancelled
// Streaming state (not persisted)
var isStreaming: Bool = false
@@ -36,6 +38,8 @@ struct Message: Identifiable, Codable, Equatable {
cost: Double? = nil,
timestamp: Date = Date(),
attachments: [FileAttachment]? = nil,
responseTime: TimeInterval? = nil,
wasInterrupted: Bool = false,
isStreaming: Bool = false,
generatedImages: [Data]? = nil
) {
@@ -46,12 +50,14 @@ struct Message: Identifiable, Codable, Equatable {
self.cost = cost
self.timestamp = timestamp
self.attachments = attachments
self.responseTime = responseTime
self.wasInterrupted = wasInterrupted
self.isStreaming = isStreaming
self.generatedImages = generatedImages
}
enum CodingKeys: String, CodingKey {
case id, role, content, tokens, cost, timestamp, attachments
case id, role, content, tokens, cost, timestamp, attachments, responseTime, wasInterrupted
}
static func == (lhs: Message, rhs: Message) -> Bool {
@@ -59,6 +65,8 @@ struct Message: Identifiable, Codable, Equatable {
lhs.content == rhs.content &&
lhs.tokens == rhs.tokens &&
lhs.cost == rhs.cost &&
lhs.responseTime == rhs.responseTime &&
lhs.wasInterrupted == rhs.wasInterrupted &&
lhs.isStreaming == rhs.isStreaming &&
lhs.generatedImages == rhs.generatedImages
}