Commit 104a27b 1 parent 8fe63d0 commit 104a27b Copy full SHA for 104a27b
File tree 1 file changed +14
-12
lines changed
1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -146,18 +146,20 @@ export class db2ContextProvider implements IContextProvider {
146
146
) ;
147
147
for ( const table of Object . keys ( tableRefs ) ) {
148
148
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
+ }
161
163
}
162
164
163
165
return contextItems ;
You can’t perform that action at this time.
0 commit comments