mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
refactor(gateway): remove unused abstract methods
This commit is contained in:
@@ -12,7 +12,7 @@ public final class PartnerAgentBootstrap extends Agent.AgentBootstrap {
|
||||
|
||||
@Override
|
||||
protected void bootstrap() {
|
||||
addGatewayRegistration(WebSocketGatewayRegistration.INSTANCE);
|
||||
addGatewayRegistration(new WebSocketGatewayRegistration());
|
||||
addConfigurable(new VectorClientRegistry());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import org.java_websocket.handshake.ClientHandshake;
|
||||
import org.java_websocket.server.WebSocketServer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import work.slhaf.partner.framework.agent.interaction.AgentGateway;
|
||||
import work.slhaf.partner.framework.agent.interaction.AgentGatewayRegistration;
|
||||
import work.slhaf.partner.framework.agent.interaction.data.InputData;
|
||||
import work.slhaf.partner.framework.agent.interaction.data.InteractionEvent;
|
||||
import work.slhaf.partner.runtime.PartnerRunningFlowContext;
|
||||
@@ -49,7 +48,6 @@ public class WebSocketGateway extends WebSocketServer implements AgentGateway<In
|
||||
}
|
||||
this.start();
|
||||
startHeartbeatThread();
|
||||
log.info("WebSocketGateway started");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,11 +138,6 @@ public class WebSocketGateway extends WebSocketServer implements AgentGateway<In
|
||||
log.info("WebSocketServer 已启动...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgentGatewayRegistration registration() {
|
||||
return WebSocketGatewayRegistration.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getChannelName() {
|
||||
|
||||
@@ -3,7 +3,7 @@ package work.slhaf.partner.runtime.gateway
|
||||
import work.slhaf.partner.framework.agent.interaction.AgentGateway
|
||||
import work.slhaf.partner.framework.agent.interaction.AgentGatewayRegistration
|
||||
|
||||
object WebSocketGatewayRegistration : AgentGatewayRegistration {
|
||||
class WebSocketGatewayRegistration : AgentGatewayRegistration {
|
||||
|
||||
override val channelName: String = "websocket_channel"
|
||||
|
||||
|
||||
@@ -7,13 +7,6 @@ public interface AgentGateway<I extends InputData, C extends RunningFlowContext>
|
||||
|
||||
void launch();
|
||||
|
||||
AgentGatewayRegistration registration();
|
||||
|
||||
@Override
|
||||
default void register() {
|
||||
registration().register();
|
||||
}
|
||||
|
||||
default void receive(I inputData) {
|
||||
C parsedContext = parseRunningFlowContext(inputData);
|
||||
AgentRuntime.INSTANCE.submit(parsedContext);
|
||||
|
||||
@@ -10,9 +10,6 @@ interface ResponseChannel {
|
||||
|
||||
fun response(event: InteractionEvent)
|
||||
|
||||
fun register() {
|
||||
AgentRuntime.registerResponseChannel(channelName, this)
|
||||
}
|
||||
}
|
||||
|
||||
object LogChannel : ResponseChannel {
|
||||
@@ -22,10 +19,6 @@ object LogChannel : ResponseChannel {
|
||||
override val channelName: String
|
||||
get() = "log_channel"
|
||||
|
||||
init {
|
||||
register()
|
||||
}
|
||||
|
||||
override fun response(event: InteractionEvent) {
|
||||
log.info(JSONObject.toJSONString(event))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user