Agent AI to document code

Post Reply
User avatar
Antonio Linares
Site Admin
Posts: 42310
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Agent AI to document code

Post by Antonio Linares »

agentdoc.prg

Code: Select all | Expand

#include "FiveWin.ch"

REQUEST DBFCDX

function Main()

   local aFiles := Directory( "c:\fwh\source\classes\*.prg" )
   local oChat  := TDeepSeek():New(), aFile
   local cPrompt := "document this code, explaining what this Class is about," + ;
                    " listing all the DATAs and METHODs," + ;
                    " and providing a brief description of each of them. Code:"

   DbCreate( "classes.dbf", { { "name", "C", 15, 0 }, { "docs", "M", 10, 0 } }, "DBFCDX" )
   USE classes

   for each aFile in aFiles
      MsgRun( "documenting " + aFile[ 1 ],;
              "please wait...", { || oChat:Send( cPrompt + ;
              hb_memoRead( "c:\fwh\source\classes\" + aFile[ 1 ] ) ) } ) 

      DbAppend()
      classes->name := aFile[ 1 ]
      classes->docs := oChat:GetValue()
   next
   
   GO TOP
   XBrowse()

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Otto
Posts: 6386
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: Agent AI to document code

Post by Otto »

Dear Antonio,
and the challenge afterward is to manage this information.

I have been working on a comprehensive DMS for a long time. That’s why I often contribute opinions suggesting that the filesystem serves as a database and some form of DBFs as content directories.
I cannot imagine that the data volumes generated by AI will work in the future by being imported into SQL and analyzed through SQL queries.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Lailton
Posts: 158
Joined: Fri Jul 20, 2012 1:49 am
Location: Brazil
Contact:

Re: Agent AI to document code

Post by Lailton »

Does it works?

:shock:
Antonio Linares wrote: Thu Jan 16, 2025 5:48 pm agentdoc.prg

Code: Select all | Expand

#include "FiveWin.ch"

REQUEST DBFCDX

function Main()

   local aFiles := Directory( "c:\fwh\source\classes\*.prg" )
   local oChat  := TDeepSeek():New(), aFile
   local cPrompt := "document this code, explaining what this Class is about," + ;
                    " listing all the DATAs and METHODs," + ;
                    " and providing a brief description of each of them. Code:"

   DbCreate( "classes.dbf", { { "name", "C", 15, 0 }, { "docs", "M", 10, 0 } }, "DBFCDX" )
   USE classes

   for each aFile in aFiles
      MsgRun( "documenting " + aFile[ 1 ],;
              "please wait...", { || oChat:Send( cPrompt + ;
              hb_memoRead( "c:\fwh\source\classes\" + aFile[ 1 ] ) ) } ) 

      DbAppend()
      classes->name := aFile[ 1 ]
      classes->docs := oChat:GetValue()
   next
   
   GO TOP
   XBrowse()

return nil
Regards,
Lailton Fernando Mariano
User avatar
Antonio Linares
Site Admin
Posts: 42310
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Agent AI to document code

Post by Antonio Linares »

Yes! :D

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42310
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Agent AI to document code

Post by Antonio Linares »

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42310
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Agent AI to document code

Post by Antonio Linares »

agentdoc2.prg is a new example using AI included in next FWH build soon to be published :)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply