protected override void Execute(CodeActivityContext context) { string text1 = Text1.Get(context); string text2 = Text2.Get(context); string apiKey = APIKey.Get(context); string seKey = SecretKey.Get(context); try { var client = new Baidu.Aip.Nlp.Nlp(apiKey, seKey); //修改超时时间 client.Timeout = 60000; //设置可选参数 var options = new Dictionary <string, object> { { "model", model } }; //带参数调用短文本相似度 string result = client.Simnet(text1, text2, options).ToString(); Result.Set(context, result); } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", e.Message); } }