Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit b99aa62

Browse files
authored
Move agent-related code into new root agent module (#811)
* Move agent-related code into new root `agent` module Webserver code that executes the agent remains in `webserver::answer`. * Move agent tool implementations to submodules
1 parent 469f8df commit b99aa62

File tree

12 files changed

+1469
-1376
lines changed

12 files changed

+1469
-1376
lines changed

server/bleep/src/agent.rs

Lines changed: 483 additions & 0 deletions
Large diffs are not rendered by default.

server/bleep/src/webserver/answer/exchange.rs renamed to server/bleep/src/agent/exchange.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ use std::mem;
33

44
use chrono::prelude::{DateTime, Utc};
55

6-
use crate::webserver::answer;
7-
86
/// A continually updated conversation exchange.
97
///
108
/// This contains the query from the user, the intermediate steps the model takes, and the final
@@ -16,7 +14,7 @@ pub struct Exchange {
1614
pub answer: Option<String>,
1715
pub search_steps: Vec<SearchStep>,
1816
pub paths: Vec<String>,
19-
pub code_chunks: Vec<answer::CodeChunk>,
17+
pub code_chunks: Vec<CodeChunk>,
2018

2119
/// A specifically chosen "focused" code chunk.
2220
///
@@ -150,6 +148,26 @@ impl SearchStep {
150148
}
151149
}
152150

151+
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
152+
pub struct CodeChunk {
153+
pub path: String,
154+
#[serde(rename = "alias")]
155+
pub alias: usize,
156+
#[serde(rename = "snippet")]
157+
pub snippet: String,
158+
#[serde(rename = "start")]
159+
pub start_line: usize,
160+
#[serde(rename = "end")]
161+
pub end_line: usize,
162+
}
163+
164+
impl CodeChunk {
165+
/// Returns true if a code-chunk contains an empty snippet or a snippet with only whitespace
166+
pub fn is_empty(&self) -> bool {
167+
self.snippet.trim().is_empty()
168+
}
169+
}
170+
153171
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
154172
pub struct FocusedChunk {
155173
pub file_path: String,
File renamed without changes.

0 commit comments

Comments
 (0)