Skip to content

Commit

Permalink
Merge pull request #55 from facebookincubator/hunter/fixes
Browse files Browse the repository at this point in the history
Plugin should receive preprocessed threadstate
  • Loading branch information
sachinkarve authored Jul 9, 2024
2 parents 1cb5e71 + 03ff1d0 commit 7a90bfa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/meta/cp4m/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import com.meta.cp4m.store.ChatStore;
import io.javalin.http.Context;
import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.*;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
Expand All @@ -29,7 +29,7 @@
public class Service<T extends Message> {

private static final Logger LOGGER = LoggerFactory.getLogger(Service.class);
private final ExecutorService executorService = Executors.newCachedThreadPool();
private final ExecutorService executorService = Executors.newVirtualThreadPerTaskExecutor();
private final MessageHandler<T> handler;
private final ChatStore<T> store;
private final Plugin<T> plugin;
Expand Down Expand Up @@ -99,9 +99,9 @@ private void execute(ThreadState<T> thread) {

T pluginResponse;
try {
pluginResponse = plugin.handle(thread);
pluginResponse = plugin.handle(preproccessed);
} catch (IOException e) {
LOGGER.error("failed to communicate with LLM", e);
LOGGER.error("Plugin failure occurred", e);
return;
}
store.add(pluginResponse);
Expand Down

0 comments on commit 7a90bfa

Please sign in to comment.