Remove file handling and operate on repository IDs (#64)

This commit is contained in:
Brian Hackett
2025-03-14 16:50:51 -07:00
committed by GitHub
parent cbd0ef3a62
commit 6f31e689de
39 changed files with 264 additions and 3581 deletions

View File

@@ -2,10 +2,11 @@ import React, { useState } from 'react';
import type { Message } from 'ai';
import { toast } from 'react-toastify';
import { createChatFromFolder } from '~/utils/folderImport';
import { logStore } from '~/lib/stores/logs'; // Assuming logStore is imported from this location
import { logStore } from '~/lib/stores/logs';
import { assert } from '~/lib/replay/ReplayProtocolClient';
import type { BoltProblem } from '~/lib/replay/Problems';
import { getProblem, extractFileArtifactsFromRepositoryContents } from '~/lib/replay/Problems';
import { getProblem } from '~/lib/replay/Problems';
import { createRepositoryImported } from '~/lib/replay/Repository';
interface LoadProblemButtonProps {
className?: string;
@@ -71,15 +72,13 @@ export async function loadProblem(
const { repositoryContents, title: problemTitle } = problem;
const fileArtifacts = await extractFileArtifactsFromRepositoryContents(repositoryContents);
try {
const messages = await createChatFromFolder(fileArtifacts, [], 'problem');
const repositoryId = await createRepositoryImported(`ImportProblem:${problemId}`, repositoryContents);
const messages = createChatFromFolder('problem', repositoryId);
await importChat(`Problem: ${problemTitle}`, [...messages]);
logStore.logSystem('Problem loaded successfully', {
problemId,
textFileCount: fileArtifacts.length,
});
toast.success('Problem loaded successfully');
} catch (error) {