using System.Collections.Generic; using System.Threading.Tasks; using LinkToolAddin.host.llm; using LinkToolAddin.host.llm.entity; using Newtonsoft.Json; namespace LinkToolAddin.resource; public class DocDb { public string appId {get;set;} public string apiKey {get;set;} public DocDb(string apiKey,KnowledgeBase knowledgeBaseEnum) { this.apiKey = apiKey; appId = knowledgeBase[knowledgeBaseEnum]; } public enum KnowledgeBase { ArcGISProHelpDoc, ArcGISProToolDoc, TaskPlanningDoc, ArcGISProApplicantExample } public Dictionary knowledgeBase = new Dictionary { {KnowledgeBase.ArcGISProHelpDoc,"6a77c5a68de64f469b79fcdcde9d5001"} }; public async Task Retrieve(string query) { Llm bailian = new Bailian { api_key = apiKey, app_id = appId, }; var commonInput = new CommonInput { Input = new Input { Prompt = query }, Parameters = new Debug(), Debug = new Debug() }; string responseBody = await bailian.SendApplicationAsync(commonInput); ApplicationOutput result = JsonConvert.DeserializeObject(responseBody); KnowledgeResult knowledgeResult = JsonConvert.DeserializeObject(result.Output.Text); return knowledgeResult; } }