new(whatsapp.gblib): LLM SQL.
This commit is contained in:
		
							parent
							
								
									f8f419f810
								
							
						
					
					
						commit
						9c53ae24bc
					
				
					 1 changed files with 26 additions and 18 deletions
				
			
		| 
						 | 
				
			
			@ -468,32 +468,40 @@ export class ChatServices {
 | 
			
		|||
        question
 | 
			
		||||
      });
 | 
			
		||||
    } else if (LLMMode === 'sql') {
 | 
			
		||||
      const con = min[`llmconnection`];
 | 
			
		||||
      const dialect = con['storageDriver'];
 | 
			
		||||
      const host = con['storageServer'];
 | 
			
		||||
      const port = con['storagePort'];
 | 
			
		||||
      const storageName = con['storageName'];
 | 
			
		||||
      const username = con['storageUsername'];
 | 
			
		||||
      const password = con['storagePassword'];
 | 
			
		||||
      // const con = min[`llmconnection`];
 | 
			
		||||
      
 | 
			
		||||
      // const dialect = con['storageDriver'];
 | 
			
		||||
      // const host = con['storageServer'];
 | 
			
		||||
      // const port = con['storagePort'];
 | 
			
		||||
      // const storageName = con['storageName'];
 | 
			
		||||
      // const username = con['storageUsername'];
 | 
			
		||||
      // const password = con['storagePassword'];
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
       const dataSource = new DataSource({
 | 
			
		||||
        type: dialect as any,
 | 
			
		||||
        host: host,
 | 
			
		||||
        port: port,
 | 
			
		||||
        database: storageName,
 | 
			
		||||
        username: username,
 | 
			
		||||
        password: password,
 | 
			
		||||
        synchronize: false, 
 | 
			
		||||
        logging: true,
 | 
			
		||||
         type: 'sqlite',
 | 
			
		||||
         database: "/home/gbadmin3910/DATA/BotServer/work/frukigbot1.gbai/data.db",
 | 
			
		||||
       });
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
      // const dataSource = new DataSource({
 | 
			
		||||
      //   type: dialect as any,
 | 
			
		||||
      //   host: host,
 | 
			
		||||
      //   port: port,
 | 
			
		||||
      //   database: storageName,
 | 
			
		||||
      //   username: username,
 | 
			
		||||
      //   password: password,
 | 
			
		||||
      //   synchronize: false, 
 | 
			
		||||
      //   logging: true,
 | 
			
		||||
      // });
 | 
			
		||||
 | 
			
		||||
      const db = await SqlDatabase.fromDataSourceParams({
 | 
			
		||||
        appDataSource: dataSource
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      const chain = new SqlDatabaseChain({
 | 
			
		||||
        llm: model,
 | 
			
		||||
        database: db
 | 
			
		||||
        database: db, 
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      result = await chain.run(question);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue