function trace_results()

in llm_demo/static/trace.js [54:76]


function trace_results(res) {
    let results;

    // Parse string to array or json object
    if (res[0] == "[" || res[0] == "{") {
        results = JSON.parse(res);
    }
    else {
        results = res;
    }

    // Parse results into array of results
    results = (Array.isArray(results)) ? results : [results]

    // Format results based on the result type
    if (typeof results[0] == "string") {
        return trace_list_str_results(results);
    }
    else if (typeof results[0] == "object") {
        return trace_list_dict_results(results);
    }
    return results;
}