(options: (string[] | LoRAOptionValue[]), value: string | LoRAOptionValue | MarketModel)
| 183 | } |
| 184 | |
| 185 | export function findValueInModelOptions(options: (string[] | LoRAOptionValue[]), value: string | LoRAOptionValue | MarketModel): string | LoRAOptionValue | undefined { |
| 186 | if (typeof value === "string") { |
| 187 | const ret = (options as string[]).find(opt => { |
| 188 | return opt === value; |
| 189 | }) |
| 190 | return ret as string |
| 191 | } |
| 192 | |
| 193 | const loraValue = value as LoRAOptionValue; |
| 194 | if (loraValue.content) { |
| 195 | const ret = (options as LoRAOptionValue[]).find((opt) => { |
| 196 | return (opt as LoRAOptionValue).content === loraValue.content; |
| 197 | }) |
| 198 | return ret as LoRAOptionValue |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | export function isMarketModel(value: any): value is MarketModel { |
| 203 | return _.isObject(value) && "type" in value && "download_url" in value && "filename" in value; |
nothing calls this directly
no outgoing calls
no test coverage detected