FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Agent AI to document code
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Agent AI to document code
Posted: Thu Jan 16, 2025 05:48 PM
agentdoc.prg
#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
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Agent AI to document code
Posted: Thu Jan 16, 2025 07:35 PM

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

Posts: 231
Joined: Fri Jul 20, 2012 01:49 AM
Re: Agent AI to document code
Posted: Fri Jan 17, 2025 03:03 AM
Does it works?

:shock:
Antonio Linares wrote: agentdoc.prg
#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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Agent AI to document code
Posted: Fri Jan 17, 2025 08:24 AM
Yes! :D

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Agent AI to document code
Posted: Fri Jan 17, 2025 11:15 PM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Agent AI to document code
Posted: Fri Jan 17, 2025 11:16 PM
agentdoc2.prg is a new example using AI included in next FWH build soon to be published :)
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion