#include "chrome/browser/ai/ai_writer.h"
#include "base/functional/bind.h"
#include "base/strings/strcat.h"
#include "chrome/browser/ai/ai_utils.h"
#include "components/optimization_guide/core/optimization_guide_util.h"
#include "components/optimization_guide/proto/common_types.pb.h"
#include "components/optimization_guide/proto/features/compose.pb.h"
#include "third_party/blink/public/mojom/ai/model_streaming_responder.mojom.h"
AIWriter::AIWriter(
std::unique_ptr<optimization_guide::OptimizationGuideModelExecutor::Session>
session,
mojo::PendingReceiver<blink::mojom::AIWriter> receiver,
const std::optional<std::string>& shared_context)
: … { … }
AIWriter::~AIWriter() { … }
void AIWriter::SetDeletionCallback(base::OnceClosure deletion_callback) { … }
void AIWriter::Write(const std::string& input,
const std::optional<std::string>& context,
mojo::PendingRemote<blink::mojom::ModelStreamingResponder>
pending_responder) { … }
void AIWriter::ModelExecutionCallback(
mojo::RemoteSetElementId responder_id,
optimization_guide::OptimizationGuideModelStreamingExecutionResult result) { … }