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