use of org.finos.symphony.toolkit.koreai.output.KoreAIResponseHandler in project spring-bot by finos.
the class KoreAIBridgeFactoryImpl method buildBridge.
@Override
public SymphonyStreamHandler buildBridge(KoreAIInstanceProperties props) {
String email = "--no email--";
try {
// build KoreAI pipeline
ApiInstance apiInstance = symphonyAPIInstance(props);
email = apiInstance.getIdentity().getEmail();
KoreAIResponseBuilder koreAIResponseBuilder = koreAIResponseBuilder();
KoreAIResponseHandler koreAIResponseHandler = responseMessageAdapter(apiInstance, props);
KoreAIRequester requester = koreAIRequester(props, koreAIResponseHandler, koreAIResponseBuilder);
List<StreamEventConsumer> consumers = new ArrayList<StreamEventConsumer>();
consumers.add(koreAIEventHandler(requester, apiInstance, props));
if (props.isSendWelcomeMessage()) {
consumers.add(new RoomWelcomeEventConsumer(apiInstance.getAgentApi(MessagesApi.class), apiInstance.getPodApi(UsersApi.class), apiInstance.getIdentity(), props.getWelcomeMessageML()));
}
// wire this up to a shared stream
SymphonyStreamHandler out = sshf.createBean(apiInstance, consumers);
return out;
} catch (Exception e) {
LOG.error("Couldn't construct Kore/Symphony bridge bean for " + email, e);
return null;
}
}
Aggregations