File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,18 +146,20 @@ export class db2ContextProvider implements IContextProvider {
146146 ) ;
147147 for ( const table of Object . keys ( tableRefs ) ) {
148148 const columnData : TableColumn [ ] = tableRefs [ table ] ;
149- const tableSchema =
150- columnData . length > 0 ? columnData [ 0 ] . TABLE_SCHEMA : null ;
151-
152- // create context item
153- let prompt = `Db2 for i Table meta data for schema ${ tableSchema } table ${ table } \n` ;
154- prompt += `Column Info: ${ JSON . stringify ( columnData ) } \n\n` ;
155-
156- contextItems . push ( {
157- name : `${ job . name } -${ tableSchema } -${ table } ` ,
158- description : `Schema and table information for ${ table } ` ,
159- content : prompt ,
160- } ) ;
149+ if ( columnData && columnData . length > 0 ) {
150+ const tableSchema =
151+ columnData . length > 0 ? columnData [ 0 ] . TABLE_SCHEMA : null ;
152+
153+ // create context item
154+ let prompt = `Db2 for i Table meta data for schema ${ tableSchema } table ${ table } \n` ;
155+ prompt += `Column Info: ${ JSON . stringify ( columnData ) } \n\n` ;
156+
157+ contextItems . push ( {
158+ name : `${ job . name } -${ tableSchema } -${ table } ` ,
159+ description : `Schema and table information for ${ table } ` ,
160+ content : prompt ,
161+ } ) ;
162+ }
161163 }
162164
163165 return contextItems ;
You can’t perform that action at this time.
0 commit comments