Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the event queuing mechanism and introduces a chat history component as evidenced by new test cases and modifications to model and chat handling code. Key changes include:
- Implementation of an EventLoop with nested task scheduling and integration tests.
- Refactoring of OpenAI and Anthropic model implementations to use a common Send interface.
- Updates to Chat functionality and connection management between models and chat sessions.
Reviewed Changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/event_loop.test.cc | Adds basic and nested task scheduling unit tests for EventLoop. |
| test/chat.test.cc | Adds tests for subscribing, unsubscribing, message responses, and lookup. |
| src/openai.cc | Refactors the OpenAI model to use a Send method and accepts a Fetch instance. |
| src/anthropic.cc | Refactors Anthropic model similar to OpenAI changes. |
| src/model.h & src/model.cc | Introduces connection management between models and chat sessions. |
| src/main.cc | Updates main loop to use a new ChatLoop with message logging. |
| src/event_loop.h & src/event_loop.cc | Implements a new event loop mechanism for asynchronous task processing. |
| src/chat.h & src/chat.cc | Adds and adjusts chat message handling and subscription behavior. |
Files not reviewed (2)
- src/BUILD.bazel: Language not supported
- test/BUILD.bazel: Language not supported
Comments suppressed due to low confidence (4)
test/chat.test.cc:41
- There appears to be an extraneous '+' character before the lambda function in the initializer list. Please remove the '+' to ensure the lambda syntax is correct.
mutex.AwaitWithTimeout({+[](std::vector<Record>* values) { return values->size() == 2; }, &messages1}, absl::Milliseconds(50));
test/chat.test.cc:48
- There is an extra '+' character before the lambda function in this initializer list. Please remove the '+' to conform to standard lambda syntax.
mutex.AwaitWithTimeout({+[](std::vector<Record>* values) { return values->size() == 3; }, &messages2}, absl::Milliseconds(50));
src/openai.cc:48
- The subscriptions_ member appears to be declared here although Model already holds a similar member. Consider removing the duplicate declaration from OpenAIModel.
std::unordered_map<Chat*, std::unique_ptr<Chat::Unsubscribe>> subscriptions_;
src/anthropic.cc:47
- The subscriptions_ member is duplicated here; since the base Model class now contains a subscriptions_ member, this duplicate should be removed from AnthropicModel.
std::unordered_map<Chat*, std::unique_ptr<Chat::Unsubscribe>> subscriptions_;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.