Skip to content

Conversation

@eugeneo
Copy link
Member

@eugeneo eugeneo commented Apr 20, 2025

No description provided.

@eugeneo eugeneo requested a review from Copilot April 20, 2025 23:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants