114 points · by frankgrecojr · 3y ago · 62 comments
Today we launched Superblocks AI and are excited to hear feedback from the HN community!
Superblocks AI combines the power of the Superblocks drag-and-drop App Builder with robust AI code generation, code optimization, code explanation, mock data generation, and API call generation across SQL, Python, JavaScript, JSON and HTML.
We built Superblocks AI with the intention to streamline some of the repetitive and often confusing aspects of building internal tools, here’s a brief overview:
Generate Code: LLMs like ChatGPT have quickly become a critical part of developers' lives and we wanted to bring that experience natively into our product. The response is streamed for the best UX, similar to Chat-GPT, and can be modified before use.
Explain Code: Understanding someone else’s code for large internal engineering teams is often a challenge. Highlight code and Superblocks AI offers an explanation that you then have the ability to add as a comment.
Edit Code: You can make alterations to code by highlighting it and choosing prompts like optimize performance, enhance readability, or something custom. We've added an inline code diff view for easy verification of changes.
Generate API Calls: You often want to make an API call but need to spend 30 minutes looking up the documentation and crafting the correct call in Postman. We provided a way for you to give a prompt, and Superblocks AI will generate REST and GraphQL queries for APIs like Stripe, Salesforce, your favorite SaaS provider, and more.
Generate Mock Data: This enables faster UI development by generating mock data for components like tables, charts, grids etc., which can be especially handy during prototyping.
I'd love to hear feedback from the HN community on how you think this feature should evolve over the next few months!
Assisting in the creation of single purpose functions is, in my experience, by far the most reliable use case for LLMs in regard to code creation at this point in time, yet is something I haven't seen many companies really lean into. In fact, the only other example I know of is Cloudflares Workers Workshop [0], which I have been waiting for since May.
What I especially like about the implementation showcased in your demo videos though was the visual component. Some subtle animations, effective use of diff, methods being editable before pasting, it all felt very cohesive and thought through, which is something I can't say about every company utilizing OpenAIs APIs. Seems more like something that can serve a real value add for users, rather than just jumping on LLMs because it's the hot thing this summer.
Really hope more people are experimenting with the "visual implementation" of LLMs, using animations and graphs to communicate LLM outputs has a lot of unused potential currently.
[0] https://blog.cloudflare.com/introducing-cursor-the-ai-assist...
This might be a bit contrarian, but I don't really think there's product market fit here, at least for engineers. And if given in the hands of non-engineers, you'll need to have an engineer at least look over the code anyway. I haven't seen or heard of anyone that seriously uses ChatGPT to generate code and uses it in prod (apart from engagement-farming Twitter posts).
> Understanding someone else’s code for large internal engineering teams is often a challenge
Without proper context, this will fail miserably. Have you ever seen a corporate codebase before? It can be the definition of "wtf?" even for a seasoned developer that's been working there for years.
This AI-generated code trend reminds me of the "no-code" fad of the past decade.
Copilot/GPT is excellent at writing lots of new lines of code. It's also really good at getting you started in code/frameworks that you don't really understand.
However, Copilot/GPT is not nearly as good at troubleshooting problems in existing code. If your job involves lots of bug fixing or tweaks to existing features, Copilot and GPT are next to useless.
I've noticed that if my work falls into the first category, Copilot often speeds me up something like 30% to 40%. If my work falls into the second category, it's 0%.
But I use it when I'm lazy, tired or at times drinking.
And then it's really nice. At times it costs me too much time solving it's mistakes. But then it nails something perfectly and I'm impressed again.
It's useful to recognize when a dialog is a dead-end, otherwise it's easy to enter a rabbit hole that the llm can't get out of. Best to poke at it from another angle and/or within a new dialog, then.
Where did anyone say it was?
They will talk down to you about it until the wave rolls over them. It’s a tradition as old as mainframe engineers mocking PDP-11 hackers.
This one will be particularly rough for the late adopters, since one of the effects of ML code generation is compression of experience level.
hi, can you write me a function in rust that, if running on windows:
1. figures out if the topmost window is a windows explorer window
2. if it's a windows explorer window, it returns the path (as a string) that the windows explorer window is actively viewing
3. if it's not a windows explorer window, it returns a blank string
This is a deceptively difficult task, as it requires all kinds of COM finagling, and ChatGPT gets it royally wrong: #[cfg(windows)]
fn get_active_explorer_path() -> String {
use std::ptr;
use winapi::um::winuser::{EnumWindows, GetWindowTextW, IsWindowVisible};
use winapi::shared::windef::HWND;
use std::os::raw::c_int;
use std::ffi::OsString;
use std::os::windows::ffi::OsStringExt;
let mut path = String::new();
let mut active_explorer = None;
unsafe extern "system" fn enum_windows_callback(hwnd: HWND, lparam: LPARAM) -> c_int {
let active_explorer = &mut *(lparam as *mut Option<HWND>);
let mut buffer: [u16; 512] = [0; 512];
if IsWindowVisible(hwnd) != 0 && GetWindowTextW(hwnd, buffer.as_mut_ptr(), 512) != 0 {
let window_title = OsString::from_wide(&buffer[..]).to_string_lossy();
if window_title == "File Explorer" {
*active_explorer = Some(hwnd);
return 0; // Stop enumeration
}
}
1 // Continue enumeration
}
unsafe {
EnumWindows(Some(enum_windows_callback), &mut active_explorer as *mut _ as LPARAM);
}
if let Some(hwnd) = active_explorer {
let mut buffer: [u16; 512] = [0; 512];
if GetWindowTextW(hwnd, buffer.as_mut_ptr(), 512) != 0 {
let window_title = OsString::from_wide(&buffer[..]).to_string_lossy();
if window_title == "File Explorer" {
let shell32 = winapi::um::shellapi::GetShellWindow();
if shell32 != hwnd {
let mut path_buffer: [u16; 512] = [0; 512];
if winapi::um::shellapi::SHGetPathFromIDListW(ptr::null_mut(), path_buffer.as_mut_ptr()) != 0 {
let path_str = OsString::from_wide(&path_buffer[..]).to_string_lossy();
path = path_str.into_owned();
}
}
}
}
}
path
}
I'm actually on my Mac right now, and I don't even need to test it, because the first red flag is `"window_title == "File Explorer"`. File Explorer will change its window titlebar to the currently viewed folder (so the conditional will always fail). There's also other comical mistakes, including passing a null pointer to `SHGetPathFromIDListW`, using `GetShellWindow` which returns the desktop, and not taking into account that Explorer windows can have multiple tabs. Okay, let's see if we fare better on MacOS. #[cfg(target_os = "macos")]
fn get_active_finder_path() -> String {
use std::ptr;
use objc::runtime::{Class, Object};
use objc::{class, msg_send, sel, sel_impl};
use objc_id::Id;
let mut path = String::new();
unsafe {
let workspace: Id<Object> = msg_send![class!(NSWorkspace), sharedWorkspace];
let front_window: Id<Object> = msg_send![workspace, frontmostApplication];
let front_window_pid: u32 = msg_send![front_window, processIdentifier];
let running_apps: Id<Object> = msg_send![workspace, runningApplications];
let app_count: usize = msg_send![running_apps, count];
for i in 0..app_count {
let app: Id<Object> = msg_send![running_apps, objectAtIndex: i];
let app_pid: u32 = msg_send![app, processIdentifier];
if app_pid == front_window_pid {
let bundle_url: Id<Object> = msg_send![app, bundleURL];
let bundle_path: *const Object = msg_send![bundle_url, path];
let path_str: *const i8 = msg_send![bundle_path, UTF8String];
if !path_str.is_null() {
let c_str = std::ffi::CStr::from_ptr(path_str);
path = c_str.to_string_lossy().to_string();
}
break;
}
}
}
path
}
#[cfg(not(target_os = "macos"))]
fn get_active_finder_path() -> String {
String::new()
}
fn main() {
let active_finder_path = get_active_finder_path();
println!("Active Finder Path: {}", active_finder_path);
}
Doesn't look like it: this is what I got, which doesn't even compile. I'm not as familiar with MacOS systems programming, so I'm not even sure what's wrong with it, frankly. My solution involved using osascript on MacOS (which is the first Google hit, though I'll have to port it, as some folks may not have it on their systems).So what is ML code generation useful for? Apart from helping on the Nth CRUD app someone's building, I just don't see it.
The real value proposition of GPT isn't that it can solve really hard problems. The value proposition is that it's about as capable as a junior engineer, except it can write code much faster than any junior engineer, so it can speed you along on the boilerplate-y parts of coding that otherwise would be a lot of manual effort. It's especially useful for things that feel "easy" but which I don't have the relevant domain expertise. For instance, the other day I needed to write a fairly trivial shell script to parse some JSON files. I never write shell scripts and I always forget the syntax, but GPT wrote it correctly on the first try. That probably saved me 20-30 minutes of googling for how to do things like read files, etc in shell scripts.
* Formatting a huge confusing blob of python code, markdown, and json into something readable.
* Writing "boring" python functions needed to interface with AWS DynamoDB & S3.
* Going from 0 -> 1 on a side project creating printable QR codes that redirect to custom links with logging. (Literally gave me picture perfect step by step instructions here, as if it was reading off the AWS UI. The sole issue I had it helped me troubleshoot).
* JS tutoring.
* Integrating an unfamiliar authentication provider with a web app. It gave me boilerplate code that needed like 1-2 tweaks to work perfectly.
* Long winded architectural discussion giving me ideas on where to take internal libraries.
Other than that, I've actually found that the github copilot CLI is a fantastic tool I've been turning to more and more. There are so many CLI tools that I kinda sorta remember the flags for, and now I no longer have to munge about looking things up. Just earlier I needed some test api key and I just said "!! generate a random api key", and it immediately came back with "openssl rand -base64 32". That works, and saved me time googling it.
Also, your prompt here is pretty weak. For something complex you need to be very specific and give it explicit instructions on how to reason through the problem, explain it's thinking, etc. I find the more context I provide in the prompt, the better it performs. In particular leveraging the system prompt makes a big difference.
It's not perfect at "zero-shot" answers but from my experience is very good when you work with it conversationally.
ChatGPT is not really equipped to do this level of code design because there are too many steps for it to handle at once. It can handle your instructions if it could first write a detailed design spec, then write code and unit tests, then run them, read the compiler output, and iteratively make changes.
IOW, this would require a purpose-built solution which uses ChatGPT's underlying engine to take your list of requirements and turn them into built and tested code.
extern crate winapi;
use std::ptr::null_mut;
use winapi::shared::guiddef::{CLSID, IID};
use winapi::um::combaseapi::{CoInitialize, CoCreateInstance};
use winapi::um::shobjidl_core::CLSID_ShellWindows;
use winapi::um::winuser::GetForegroundWindow;
use winapi::Interface;
use winapi::shared::winerror::{HRESULT, SUCCEEDED};
use winapi::um::exdisp::IWebBrowser2;
use winapi::um::unknwnbase::IUnknown;
use winapi::um::oleidl::IDispatch;
use winapi::shared::wtypes::BSTR;
use winapi::um::winnt::LPCWSTR;
use winapi::shared::ntdef::VOID;
use std::ffi::OsString;
use std::os::windows::ffi::OsStringExt; // Helper function to convert a wide string to a Rust string
wide_to_string(wide: &[u16]) -> String {
OsString::from_wide(&wide)
.to_string_lossy()
.into_owned()
} // Helper function to convert BSTR to Rust String
fn bstr_to_string(bstr: BSTR) -> String {
unsafe {
let length = winapi::um::oleauto::SysStringLen(bstr) as usize;
let slice = std::slice::from_raw_parts(bstr, length);
wide_to_string(slice)
}
} fn main() {
unsafe {
// Initialize COM
let hr = CoInitialize(null_mut());
if SUCCEEDED(hr) {
let mut shell_windows_ptr: *mut IUnknown = null_mut();
let shell_windows_iid: IID = IShellWindows::uuidof();
let shell_windows_clsid: CLSID = CLSID_ShellWindows;
// Create IShellWindows instance
let hr = CoCreateInstance(
&shell_windows_clsid,
null_mut(),
winapi::um::combaseapi::CLSCTX_ALL,
&shell_windows_iid,
&mut shell_windows_ptr as *mut _ as _,
);
if SUCCEEDED(hr) {
let shell_windows_dispatch: &IDispatch = &*(shell_windows_ptr as *mut IDispatch);
let hwnd = GetForegroundWindow() as LPCWSTR;
// Get Item of IShellWindows
let mut result = null_mut();
let mut params = winapi::um::oaidl::DISPPARAMS {
cArgs: 1,
cNamedArgs: 0,
rgvarg: &mut winapi::um::oaidl::VARIANTARG {
n1: winapi::um::oaidl::VARIANTARG_0 {
n2: winapi::um::oaidl::VARIANTARG_0_0 {
vt: winapi::um::oaidl::VT_I4 as u16,
wReserved1: 0,
wReserved2: 0,
wReserved3: 0,
n3: winapi::um::oaidl::VARIANTARG_0_0_0 {
lVal: hwnd as _,
}
}
}
},
rgdispidNamedArgs: null_mut(),
};
shell_windows_dispatch.Invoke(
winapi::um::exdisp::DISPID_ISHELLWINDOWS_ITEM,
&winapi::shared::guiddef::IID_NULL,
winapi::um::winnls::LOCALE_USER_DEFAULT,
winapi::um::oaidl::DISPATCH_METHOD,
&mut params,
&mut result,
null_mut(),
null_mut(),
);
// Convert result to IWebBrowser2
let web_browser2: &IWebBrowser2 = &*(result.pdispVal as *mut IWebBrowser2);
// Get LocationURL property of IWebBrowser2
let mut location_url: BSTR = null_mut();
web_browser2.get_LocationURL(&mut location_url);
let path = bstr_to_string(location_url);
println!("Path: {}", path);
} else {
println!("Failed to create IShellWindows instance.");
}
} else {
println!("Failed to initialize COM.");
}
}
extern crate winapi;
use std::ptr::null_mut;
use winapi::shared::guiddef::{CLSID, IID};
use winapi::um::combaseapi::{CoInitialize, CoCreateInstance};
use winapi::um::shobjidl_core::CLSID_ShellWindows;
use winapi::um::winuser::GetForegroundWindow;
use winapi::Interface;
use winapi::shared::winerror::{HRESULT, SUCCEEDED};
use winapi::um::exdisp::IWebBrowser2;
use winapi::um::unknwnbase::IUnknown;
use winapi::um::oleidl::IDispatch;
use winapi::shared::wtypes::BSTR;
use winapi::um::winnt::LPCWSTR;
use winapi::shared::ntdef::VOID;
use std::ffi::OsString;
use std::os::windows::ffi::OsStringExt;// Helper function to convert a wide string to a Rust string fn wide_to_string(wide: &[u16]) -> String { OsString::from_wide(&wide) .to_string_lossy() .into_owned() }
// Helper function to convert BSTR to Rust String fn bstr_to_string(bstr: BSTR) -> String { unsafe { let length = winapi::um::oleauto::SysStringLen(bstr) as usize; let slice = std::slice::from_raw_parts(bstr, length); wide_to_string(slice) } }
fn main() { unsafe { // Initialize COM let hr = CoInitialize(null_mut());
if SUCCEEDED(hr) {
let mut shell_windows_ptr: *mut IUnknown = null_mut();
let shell_windows_iid: IID = IShellWindows::uuidof();
let shell_windows_clsid: CLSID = CLSID_ShellWindows;
// Create IShellWindows instance
let hr = CoCreateInstance(
&shell_windows_clsid,
null_mut(),
winapi::um::combaseapi::CLSCTX_ALL,
&shell_windows_iid,
&mut shell_windows_ptr as *mut _ as _,
);
if SUCCEEDED(hr) {
let shell_windows_dispatch: &IDispatch = &*(shell_windows_ptr as *mut IDispatch);
let hwnd = GetForegroundWindow() as LPCWSTR;
// Get Item of IShellWindows
let mut result = null_mut();
let mut params = winapi::um::oaidl::DISPPARAMS {
cArgs: 1,
cNamedArgs: 0,
rgvarg: &mut winapi::um::oaidl::VARIANTARG {
n1: winapi::um::oaidl::VARIANTARG_0 {
n2: winapi::um::oaidl::VARIANTARG_0_0 {
vt: winapi::um::oaidl::VT_I4 as u16,
wReserved1: 0,
wReserved2: 0,
wReserved3: 0,
n3: winapi::um::oaidl::VARIANTARG_0_0_0 {
lVal: hwnd as _,
}
}
}
},
rgdispidNamedArgs: null_mut(),
};
shell_windows_dispatch.Invoke(
winapi::um::exdisp::DISPID_ISHELLWINDOWS_ITEM,
&winapi::shared::guiddef::IID_NULL,
winapi::um::winnls::LOCALE_USER_DEFAULT,
winapi::um::oaidl::DISPATCH_METHOD,
&mut params,
&mut result,
null_mut(),
null_mut(),
);
// Convert result to IWebBrowser2
let web_browser2: &IWebBrowser2 = &*(result.pdispVal as *mut IWebBrowser2);
// Get LocationURL property of IWebBrowser2
let mut location_url: BSTR = null_mut();
web_browser2.get_LocationURL(&mut location_url);
let path = bstr_to_string(location_url);
println!("Path: {}", path);
} else {
println!("Failed to create IShellWindows instance.");
}
} else {
println!("Failed to initialize COM.");
}
}
}
}I have. And I'm sure others have too. I dare say there are many who probably _shouldn't_ be using it because of privacy/IP concerns and so you won't hear about them.
> cute novelty [...]
I thought the same not so long ago. But gpt4 for me was a game changer. It's helped me debug and fix some legitimately complex code, and has been awesome at wholesale refactoring modules to fulfil a new purpose. E.g. today I wanted help reconciling between runtime and persistent LRU cache stuff. And it understood what I wanted and assisted. After a few nudges it gave me a refactored module with comments and a few tests. It's like having a very capable junior dev in one's pocket :P
Ps. Trust me: it's not long before we have ai coding bots that grab open tickets and hammer together PRs with full testing suites. I imagine it's already happening.
Not quite, that I know of, but some of us are working on it :)
I have a feeling that while the glorious future you describe can probably be realized using LLMs as a foundational technology, the software engineering effort needed to get there is on par with other AI moonshot projects e.g. autonomous vehicles.
If you or others reading this are interested in this topic, see this post for some interesting discussion and links to projects in development (and in the comments there's a link to a Discord server that was set up for further discussion): https://news.ycombinator.com/item?id=36422730
I would agree with this in general. The main goal here is to optimize the "editor experience". When I personally code, I'll have ChatGPT pulled up on the side in case I need to reference it for speed. Some examples of how I might use it are:
- add some tests for me to review - take an existing piece of code and modify it in some way - help me think of ways in which I can write some code if I'm lazy that day.
This would generate code that after I iterate on it would need to be reviewed which speaks to your point, "you'll need to have an engineer at least look over the code anyway" which I agree with.
The main goal is to have it there as a resource to pair program with rather than trusting it without review/input.
The value added is that you don't send your source code to OpenAI and/or their parent org Microsoft.
Recently I've been using git diff and asking 3.5 to write the PR description for me and so far it is doing quite well. The 16k tokens means I can feed even more into it.
I've been focused on similar concepts with my open source AI coding tool. My tool is a command line GPT chat tool. You can ask it to write or edit code in any git repo. It displays live diffs as the AI edits stream in and automatically integrates them into your source files. I think this is similar to what your article is describing?
Folks might want to check out `aider` if they want to do the style of AI coding you're showing, but on their own git repos.
However, for me, what I was hoping it was/ one thing I'm still looking for: Feed in my whole repo to the GPT-4 API, train on it, and ask questions about the code base/ particular functions. Has anyone seen that?
https://aider.chat/examples/2048-game.html
Here's an article about how it does that:
https://aider.chat/docs/ctags.html
I think bloop is also good for searching and Q&A against code. I'm not sure if it will let you edit/modify the code though.
> what's a simple, popular open source android app?
One simple and popular open source Android app is "Minimal ToDo". It's a simple task management app with a clean, minimalistic user interface. The source code is available on GitHub and it's a great project for beginners who want to understand the structure and functioning of an Android app.
> clone command to clone minimal todo?
To clone the Minimal ToDo app from GitHub, you can use the following command:
```bash
git clone https://github.com/avjinder/Minimal-Todo.git
```
This will create a local copy of the Minimal ToDo repository on your machine.> tell me about the overall structure of this codebase
This codebase appears to be for an Android application, specifically a to-do list app. The structure is typical of an Android project, with Java source files, XML layout files, and resource files.
1. Java Source Files: These are located in the `app/src/main/java/com/example/avjindersinghsekhon/minimaltodo` directory. The package structure suggests that the app is divided into several modules such as `About`, `AddToDo`, `Analytics`, `AppDefault`, `Main`, `Reminder`, `Settings`, and `Utility`. Each module contains classes related to its functionality.
2. XML Layout Files: These are located in the `app/src/main/res/layout` directory. They define the user interface for different activities and fragments in the app.
3. Resource Files: These include drawable resources (images, icons), values (strings, dimensions, colors), and menu definitions. They are located in the `app/src/main/res` directory.
4. Gradle Files: The `build.gradle` files specify the build configuration for the app. There are typically two such files in an Android project: one for the project and one for the app module.
5. Test Files: These are located in the `app/src/androidTest/java/com/example/avjindersinghsekhon/minimaltodo` directory. They contain tests for the application's functionality.
6. Manifest File: The `AndroidManifest.xml` file in the `app/src/main` directory declares the app's components to the Android system and specifies permissions and other app requirements.
7. Properties and Configuration Files: Files like `gradle.properties` and `.travis.yml` are used for configuration of the build system and continuous integration services.
8. Other Files: The `google-services.json` file is typically used for configuring services from Google Firebase. The `.idea` directory contains configuration files for the IntelliJ IDEA IDE.
about.sourcegraph.com
I really like it for figuring out how something in my code base is done, like figuring out where exactly rate limits happen and what service we use to track them.
As with all low-code / no-code solutions, you can't please all the people all the time. But I felt the design choice in this particular case was overly rigid and with little justification.
With that being said, there may be ways to accomplish what you're looking for with the current state of our Workflows feature so feel free to send me a DM on Twitter or Linkedin.
The fact that it's even willing to write a function which removes PII from a string is nonsense. No such function is possible.
And the comment for filterUsersTable is incredibly long, tedious, and unhelpful.
How does the SQL thing work? How does it know what my schema is? That's nowhere on screen.
The only believable example is the Salesforce one which anyone could do.
This is good feedback. I think having an ability to adjust verbosity is valuable. A comment version should maybe be more concise than the actual explanation.
> How does the SQL thing work? How does it know what my schema is? That's nowhere on screen.
When you configure integrations with Superblocks, we query your integrations metadata which we use to give the best answers here.
I presume you bought the domain name from them in that case.
ZIRP Hustle is real.
In terms of ChatGPT, Superblocks's goal is to develop a simple visual interface for creators to integrate AI into their workflow to build applications quickly. The platform makes it easy to verify, deploy, and monitor your changes, which would be difficult to do with just a chat interface.
Budibase. https://github.com/Budibase/budibase
Appsmith. https://github.com/appsmithorg
Tooljet https://github.com/ToolJet/ToolJet
And more (I'm sure others will comment)