MCPcopy Create free account
hub / github.com/6174/comflowyspace / findValueInModelOptions

Function findValueInModelOptions

packages/common/types/model.types.ts:185–200  ·  view source on GitHub ↗
(options: (string[] | LoRAOptionValue[]), value: string | LoRAOptionValue | MarketModel)

Source from the content-addressed store, hash-verified

183}
184
185export 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
202export function isMarketModel(value: any): value is MarketModel {
203 return _.isObject(value) && "type" in value && "download_url" in value && "filename" in value;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected