@@ -18,7 +18,7 @@ import { DataTypeEnum } from "@/src/types/shared/general";
1818import { runAttributeLlmPlayground } from "@/src/services/base/attribute" ;
1919import { jsonCopy } from "@/submodules/javascript-functions/general" ;
2020import { TEMPLATE_EXAMPLES , TEMPLATE_OPTIONS } from "./llmTemplates" ;
21- import { LLM_PROVIDER_OPTIONS } from "@/src/util/components/projects/projectId/settings/attribute-calculation-helper" ;
21+ import { LLM_PROVIDER_OPTIONS , postProcessLLMPlaygroundRecordData } from "@/src/util/components/projects/projectId/settings/attribute-calculation-helper" ;
2222
2323const ACCEPT_BUTTON = { buttonCaption : "Use current values for attribute" , useButton : true } ;
2424const DISPLAY_STATES = [ AttributeState . AUTOMATICALLY_CREATED , AttributeState . UPLOADED , AttributeState . USABLE ]
@@ -45,15 +45,12 @@ export default function LLMPlaygroundModal() {
4545 const searchAndSetWithFilter = useCallback ( ( filter ) => {
4646 searchRecordsExtended ( projectId , filter , 0 , 1 , ( res ) => {
4747 if ( res && res . recordList ) {
48- if ( res . recordList . length == 0 ) {
48+ const parsedData = postProcessLLMPlaygroundRecordData ( res . recordList ) ;
49+ if ( ! parsedData ) {
4950 console . warn ( "No records found -> using random instead" ) ;
5051 get1RandomRecords ( ) ;
5152 return ;
5253 }
53- const parsedData = res . recordList . map ( ( record ) => {
54- const parsed = JSON . parse ( record . recordData ) ;
55- return ( { ...parsed . data , id : parsed . id } ) ;
56- } ) ;
5754 setRecordData ( parsedData ) ;
5855 }
5956 } ) ;
0 commit comments