memoryd: ask_memory, each workspace's chat at once with its own limit
Co-Authored-By: ornith-1.5-35b-a3b <agent@wntrmute.dev>
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
//! responses recorded from rift (`tests/fixtures/honcho/`), by method and path (a batch of
|
||||
//! messages or conclusions answered with as many as it asked for, up to the two recorded), and
|
||||
//! records every request, body included. It can be set to answer every request with a status
|
||||
//! instead, to answer nothing, or to answer as a workspace that does not exist, for every
|
||||
//! workspace or for one. Stopped, and its held connections released, when dropped; every wait has
|
||||
//! instead, to answer nothing, to answer as a workspace that does not exist, or to answer a chat
|
||||
//! with a given text, for every workspace or for one. Stopped, and its held connections released, when dropped; every wait has
|
||||
//! a deadline. Do not edit.
|
||||
|
||||
#![allow(dead_code)] // each test file uses a different part of this module
|
||||
@@ -50,6 +50,8 @@ pub enum Mode {
|
||||
/// As a workspace that does not exist: a search or a conclusion query answers 200 with no
|
||||
/// hits (fixtures 34, 35), chat 404 (36).
|
||||
Missing,
|
||||
/// A chat answers 200 with this text as its `content`; anything else as `Fixtures`.
|
||||
Chat(&'static str),
|
||||
}
|
||||
|
||||
struct Shared {
|
||||
@@ -238,6 +240,8 @@ fn answer(request: &Request, made: &Mutex<HashSet<String>>) -> (u16, String) {
|
||||
request,
|
||||
"conclusions",
|
||||
),
|
||||
// A workspace chat answers the recorded one at `minimal` (fixture 19), whatever it asked.
|
||||
("POST", ["v3", "workspaces", _, "chat"]) => fixture("19-workspace-chat.json"),
|
||||
// A search answers the three recorded messages about tea (fixture 30), whatever it asked.
|
||||
("POST", ["v3", "workspaces", _, "search"]) => fixture("30-workspace-search-limit.json"),
|
||||
// A conclusion query answers the recorded one about the owner (32) when it asks about
|
||||
@@ -296,6 +300,11 @@ fn serve(mut stream: TcpStream, shared: &Shared) {
|
||||
fixture("35-conclusions-query-missing-workspace.json")
|
||||
}
|
||||
Mode::Missing => fixture("36-workspace-chat-missing-workspace.json"),
|
||||
Mode::Chat(content) if request.path.ends_with("/chat") => (
|
||||
200,
|
||||
serde_json::json!({ "content": content, "evidence": null }).to_string(),
|
||||
),
|
||||
Mode::Chat(_) => answer(&request, &shared.made),
|
||||
Mode::Status(422) => {
|
||||
let input = request.body.clone().unwrap_or(Value::Null);
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user