PromtGarageMac / Sources /PromptGarageCore /Models /PromptStatistics.swift
smlflg's picture
Initial public upload from Projekte/PromtGarageMac
4977db2 verified
Raw History Blame Contribute Delete
1.32 kB
import Foundation
public struct CountedValue: Identifiable, Hashable, Sendable {
public var id: String { name }
public let name: String
public let count: Int
public init(name: String, count: Int) {
self.name = name
self.count = count
}
}
public struct PromptStatistics: Sendable {
public let total: Int
public let starred: Int
public let totalUses: Int
public let sourceFamilies: [CountedValue]
public let models: [CountedValue]
public let tags: [CountedValue]
public let ratingDistribution: [Int: Int]
public init(
total: Int,
starred: Int,
totalUses: Int,
sourceFamilies: [CountedValue],
models: [CountedValue],
tags: [CountedValue],
ratingDistribution: [Int: Int]
) {
self.total = total
self.starred = starred
self.totalUses = totalUses
self.sourceFamilies = sourceFamilies
self.models = models
self.tags = tags
self.ratingDistribution = ratingDistribution
}
public static let empty = PromptStatistics(
total: 0,
starred: 0,
totalUses: 0,
sourceFamilies: [],
models: [],
tags: [],
ratingDistribution: Dictionary(uniqueKeysWithValues: (0...5).map { ($0, 0) })
)
}