MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / appendShareGptRecord

Function appendShareGptRecord

src/agent/dataset-export.ts:71–82  ·  view source on GitHub ↗
(projectRoot: string, messages: Message[])

Source from the content-addressed store, hash-verified

69 * logged and swallowed. A record with fewer than 2 turns (no real exchange) is skipped.
70 */
71export async function appendShareGptRecord(projectRoot: string, messages: Message[]): Promise<void> {
72 try {
73 const rec = toShareGpt(messages);
74 if (rec.conversations.length < 2) return; // nothing trainable
75 const full = datasetPath(projectRoot);
76 await fs.mkdir(path.dirname(full), { recursive: true });
77 await fs.appendFile(full, JSON.stringify(rec) + '\n', 'utf-8');
78 logger.info('Dataset record exported (ShareGPT)', { file: full, turns: rec.conversations.length });
79 } catch (e: any) {
80 logger.debug('Dataset export skipped', { err: e?.message });
81 }
82}
83
84/** Absolute path to a project's ShareGPT dataset (for fine-tune tooling). */
85export function getShareGptDatasetPath(projectRoot: string): string {

Callers 1

runSandboxedMethod · 0.85

Calls 4

toShareGptFunction · 0.85
datasetPathFunction · 0.85
infoMethod · 0.80
debugMethod · 0.80

Tested by

no test coverage detected