assistant2: Add ability to fetch URLs as context (#21988)
This PR adds the ability to fetch URLs as context in Assistant2. In the picker we use the search area as an input for the user to enter the URL they wish to fetch: <img width="1159" alt="Screenshot 2024-12-13 at 2 45 41 PM" src="https://github.com/user-attachments/assets/b3b20648-2c22-4509-b592-d0291d25b202" /> <img width="1159" alt="Screenshot 2024-12-13 at 2 45 47 PM" src="https://github.com/user-attachments/assets/7e6bab2d-2731-467f-9781-130c6e4ea5cf" /> Release Notes: - N/A
This commit is contained in:
parent
19d6e067af
commit
c57cc35b03
7 changed files with 261 additions and 8 deletions
|
@ -193,12 +193,19 @@ impl Thread {
|
|||
|
||||
if let Some(context) = self.context_for_message(message.id) {
|
||||
let mut file_context = String::new();
|
||||
let mut fetch_context = String::new();
|
||||
|
||||
for context in context.iter() {
|
||||
match context.kind {
|
||||
ContextKind::File => {
|
||||
file_context.push_str(&context.text);
|
||||
file_context.push_str("\n");
|
||||
file_context.push('\n');
|
||||
}
|
||||
ContextKind::FetchedUrl => {
|
||||
fetch_context.push_str(&context.name);
|
||||
fetch_context.push('\n');
|
||||
fetch_context.push_str(&context.text);
|
||||
fetch_context.push('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,6 +216,11 @@ impl Thread {
|
|||
context_text.push_str(&file_context);
|
||||
}
|
||||
|
||||
if !fetch_context.is_empty() {
|
||||
context_text.push_str("The following fetched results are available\n");
|
||||
context_text.push_str(&fetch_context);
|
||||
}
|
||||
|
||||
request_message
|
||||
.content
|
||||
.push(MessageContent::Text(context_text))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue