Introducing CodeBot

2 Likes

How do I know its doing something ? I highlighted some code and asked what this does. I see a link in activity but nothing else seems to happen.

Also should you give an extra warning that its sending you code over the internet ?

I found you need to launch the codebot window yourself and its already done its stuff.

Its amazing how descriptive it is

What does this code do?

  using connection := builder.Build do
  begin
    var rows := await connection.QueryAsync('select * from employees');
    if rows.Any then
    begin
      Console.WriteLine('Rows');
    end;
  end;
RDSIAMAuthConsoleApplication, Program.pas, line 16-23
This code block establishes a database connection through a builder object in RemObjects Oxygene for .NET Core. It then asynchronously retrieves data from a table named "employees" using a SQL query. If the query returns any rows, it prints the string "Rows" to the console. The using block ensures that the connection is properly disposed of once the query has finished executing.

Weird. It should open the window automatically if you invoke CodeBot. What do you see, UI wise?Nothing at all? Any error messages in Activity?

:upside_down_face:

I see nothing ui wise. Im using Fire

Just this in activity

href <a href="code://file:///Users/JohnMoshakis/Documents/develop/Moshine.Foundation.Samples/Moshine.Foundation.Samples.sln%3Bfile:///Users/JohnMoshakis/Documents/develop/Moshine.Foundation.Samples/RDSIAMAuthConsoleApplication/RDSIAMAuthConsoleApplication.elements%3Bfile:///Users/JohnMoshakis/Documents/develop/Moshine.Foundation.Samples/RDSIAMAuthConsoleApplication/Program.pas%3B3/0%2D6/25" class="code-link">RDSIAMAuthConsoleApplication, Program.pas, line 4-6</a>

It even understands using statements.

This code imports three namespaces: Dapper, System.Linq, and System.Threading.Tasks. This allows the code to use classes and methods from these namespaces without needing to fully qualify them each time they are used. Dapper is a popular Object-Relational Mapping (ORM) tool for .NET databases, while System.Linq and System.Threading.Tasks are both part of the .NET Core framework and provide functionality for querying data and managing asynchronous tasks, respectively.

How does it know so much ?

Ah, that’s debug logging for creating the inline links that I forgot to remove. Will fix.

Curious. So essentially, when you do Window|CodeBot, the window shows, but when you just income CodeBot from the editor, it runs the request but does not open/show the CodeBot window until you open it manually? very strange.

It really is astounding, yeah.

Oops, found the problem; CodeBot was behind some “only enable this feature on internal systems” checks, and there was one I forgot to remove :sob:. Fixed for vNext.

I had a go with bing asking it the kind of stuff I use stackoverflow for and most of the time it gave up. It seemed to work with c# but not Oxygene.

I dont know if it would be any different if I gave it method but this seems so much better. So far I have only given it small methods, I need to find some code I wrote a long time ago to see what it says.

I think it would be really good for documentation.

1 Like

I haven’t tried that yet, specifically, but I would assume (and hear) that its good at that too yeah.

Would it be possible for you take a class, extract the all public methods and send those ? Could you then generate documentation for that ? Like html or something else.

Try it ;). the main issue will be that if you send too much code, you will run into the 4096 token limit of GPT 3.5. (4.0 increases that to 8k, once I have access to the 4.0 API, which I’m on the wait list for, I’ll expose an option to choose the model in Preferences).

I suppose I could/should also expose CodeBot in the context menu for “Peek at Definition” (currently it’s disabled there), which would allow you to do ⌘D on a type and then send the “declaration-only” view to CodeBot. This will need a bit of rethinking to do, though.

1 Like

Would it be possible to save a list of things I’ve asked ? I could see myself asking some of them again.

1 Like

Good idea. Are you thinking more like a history (think navigating up/down, like in Find, to go to previous messages) in the question box, or an archive of previous chats? (or both?)

I was thinking of adding to the list here

Screenshot 2023-04-21 at 7.48.40 AM

I found I could highlight a namespace and get it to tell me what nuget it was from. I would like to have a short description and it repeat the same question I had asked on what I highlighted.

Both of those sound good as well.

1 Like

Ah, I suppose. Of course that comes with the headache of having UI to manage that list, as well. I’ll think about what best to do here.