Skip to content

Commit

Permalink
ignore context item it its empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ajshedivy committed Nov 6, 2024
1 parent 8fe63d0 commit 104a27b
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/aiProviders/continue/continueContextProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,20 @@ export class db2ContextProvider implements IContextProvider {
);
for (const table of Object.keys(tableRefs)) {
const columnData: TableColumn[] = tableRefs[table];
const tableSchema =
columnData.length > 0 ? columnData[0].TABLE_SCHEMA : null;

// create context item
let prompt = `Db2 for i Table meta data for schema ${tableSchema} table ${table}\n`;
prompt += `Column Info: ${JSON.stringify(columnData)}\n\n`;

contextItems.push({
name: `${job.name}-${tableSchema}-${table}`,
description: `Schema and table information for ${table}`,
content: prompt,
});
if (columnData && columnData.length > 0) {
const tableSchema =
columnData.length > 0 ? columnData[0].TABLE_SCHEMA : null;

// create context item
let prompt = `Db2 for i Table meta data for schema ${tableSchema} table ${table}\n`;
prompt += `Column Info: ${JSON.stringify(columnData)}\n\n`;

contextItems.push({
name: `${job.name}-${tableSchema}-${table}`,
description: `Schema and table information for ${table}`,
content: prompt,
});
}
}

return contextItems;
Expand Down

0 comments on commit 104a27b

Please sign in to comment.