Arka
November 23, 2024, 11:34am
1
this fork has a working import function - Fork
i tried and it works.
you simply click “clone” and put your github repo link
the author of the fork has posted the cloning script in the description, so maybe someone can add it to oTToDev?
I would use that fork, but OpenAILike models don’t work there (for some reason the fork always loads BASE URL from OpenAI and ignores urls in the .env )
2 Likes
@Arka thanks for the hint!
Have you also tested that after importing a repo the LLM knows about the code it imported?
You can simple verify this by importing the repo and then ask “describe whatt his project is about”.
Arka
November 23, 2024, 5:35pm
3
idk if it’s know context, because models are not working…
i don’t have open ai keys to test it (as i said, it always loads open ai for some reason)
Dredd
November 23, 2024, 7:07pm
4
yep, the longer context works to describe the cloned repos once reloaded (which it suggests to do) and takes a while on a smallish repo but it gets there rather than just stopping as happened before.
Review by Qwen Codrer 7B.
## Selectron
The app in WebContainer appears to be a backend and frontend application built using;
Rust, JavaScript, and TypeScript.
Here's a breakdown of its key components: This breakdown provides a comprehensive overview
of the project structure and key components, formatted in GitHub Markdown for clarity and readability.
### Summary
The app appears to be a full-stack solution that combines backend and frontend logic,
with IPC communication between them. It supports various features such as executing
shell commands, managing databases, and handling user interactions through a web interface.
The use of Rust for the backend suggests performance and safety benefits, while
TypeScript and JavaScript/TypeScript for the frontend provide modern development tools
and better code organization.
---
This file has been truncated. show original
1 Like
burgil
November 24, 2024, 6:45pm
5
Hi, I created the fork, The issue you are having is weird we didn’t have that, We tested with:
Mistral
OpenAILike
Ollama
all worked great, must be something on your end
Note: I didn’t submit a PR because of the many visual changes I’ve done that I’m not sure everyone needs, feel free to take the important parts and integrate it back to the original
1 Like
burgil
November 24, 2024, 6:46pm
6
And yes the model is aware of the changes after the reload, but it overrides the current conversation because I was lazy lol, Feel free to take my changes we already completed our goals
Note: It takes a while to clone because I added 300ms delay between files for no good reason
Note 2: The appended user messages may be removed - untested
1 Like
burgil
November 24, 2024, 6:49pm
7
So here is what my friend did to fix the OpenAILike using my fork:
Rename .env.local.rename
to .env.local
Fill in there both the base url and the api key, not from the website
Worked
(Make sure you restart the app .env changes requires a full restart)
Also the external nodejs script is not used anymore I integrated it on the website itself instead
For more information about how I figured it out: (Saving changes after reload when cloning)
opened 09:35PM - 22 Nov 24 UTC
closed 06:22PM - 23 Nov 24 UTC
https://github.com/user-attachments/assets/e962508f-29b7-4356-926d-42aa34e95a07
…
**in the video, you see I uploaded files from a previous bolt project I made on the official bolt website. Below is the code I use to transfer files from a GitHub repo into the bolt.new local version but as you can see in the video it deletes the files upon refresh and also doesn't not know the context of the code that is imported**
help would be appreciated thanks
boltsyncfix.js
```js
const https = require('node:https');
const readline = require('node:readline');
const querystring = require('node:querystring');
const fs = require('node:fs');
const parseGitHubUrl = (url) => {
const match = url.match(/github\.com\/([^/]+)\/([^/]+)/);
if (!match) throw new Error("Invalid GitHub URL format");
return { owner: match[1], repo: match[2] };
};
const fetchData = (url, options) => {
return new Promise((resolve, reject) => {
const req = https.get(url, options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
if (res.statusCode >= 200 && res.statusCode < 300) {
resolve(JSON.parse(data));
} else {
reject(new Error(data));
}
});
});
req.on('error', reject);
req.end();
});
};
const uploadToPastebin = async (content, apiKey) => {
return new Promise((resolve, reject) => {
const postData = querystring.stringify({
api_dev_key: apiKey,
api_option: 'paste',
api_paste_code: content,
api_paste_format: 'bash',
api_paste_private: 1, // 0=public, 1=unlisted, 2=private
});
const options = {
hostname: 'pastebin.com',
path: '/api/api_post.php',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(postData),
},
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
if (res.statusCode === 200) {
resolve(data); // Pastebin returns the paste URL on success
} else {
reject(new Error(`Pastebin API error: ${data}`));
}
});
});
req.on('error', (error) => reject(error));
req.write(postData);
req.end();
});
};
const getRawFileLinks = async (url) => {
try {
const { owner, repo } = parseGitHubUrl(url);
const branch = "main";
const apiUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}?recursive=1`;
const options = {
headers: {
'User-Agent': 'Node.js',
},
};
const treeData = await fetchData(apiUrl, options);
const files = treeData.tree.filter((item) => item.type === "blob");
const rawLinks = files.map((file) => ({
link: `https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${file.path}`,
path: file.path,
}));
const scriptContent = rawLinks
.map(({ link, path }) => {
const dir = path.includes('/') ? `mkdir -p "${path.substring(0, path.lastIndexOf('/'))}" && ` : '';
return `${dir}curl -o "${path}" "${link}"`;
})
.join('\n');
// const response = await uploadToPastebin(scriptContent, "");
// console.log(response);
console.log('Script written to creator.sh');
fs.writeFileSync('creator.sh', scriptContent, 'utf-8');
// if (response.toString().startsWith('https://pastebin.com/')) {
// const paste = response.toString().replace('https://pastebin.com/', 'https://pastebin.com/raw/');
// console.log("\x1b[32mTo install this repository on your local Bolt website run:\x1b[0m");
// console.log(`\x1b[33m curl -o creator.sh ${paste}\x1b[0m`);
// console.log("\x1b[30mTo clean all existing files run:\x1b[0m");
// console.log("\x1b[30m rm -rf *\x1b[0m");
// }
} catch (error) {
console.error("Error:", error.message);
}
};
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.question("Enter the GitHub repository URL: ", (url) => {
getRawFileLinks(url).finally(() => rl.close());
});
```
1 Like
I finally get to proof of concept for folder import
Githup import is after that
And it works on reloads
Needs some work but is a good foundation
Here is PR
coleam00:main
← wonderwhy-er:Import-folder
opened 08:25AM - 25 Nov 24 UTC
This is proof of concept for folder import
It allows to start a new chat with s… electing a folder
First message in the chat will be message similar to one AI returns with file content to create project from
## Still needs to be tested + other things to do
- There will be problems with binary files like images, need to ignore them for now
- I have ideas of how to support image and other file uploads in future
- May be we need to ask AI to inspect the project and run commands to show preview?
## Video:
https://github.com/user-attachments/assets/f619d863-6baa-4d53-bf0a-42c020620729
3 Likes