Skip to content

Commit cc20369

Browse files
authored
Merge pull request #881 from dcSpark/nico/extend_dates
Nico/extend dates
2 parents a70814d + 9396874 commit cc20369

File tree

6 files changed

+34
-25
lines changed

6 files changed

+34
-25
lines changed

Cargo.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ members = [
1919
resolver = "2"
2020

2121
[workspace.package]
22-
version = "0.9.10"
22+
version = "0.9.11"
2323
edition = "2021"
2424
authors = ["Nico Arqueros <nico@shinkai.com>"]
2525

shinkai-bin/shinkai-node/src/llm_provider/execution/chains/generic_chain/generic_prompts.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use serde_json::json;
22
use shinkai_fs::shinkai_file_manager::ShinkaiFileManager;
33
use shinkai_sqlite::SqliteManager;
4-
use std::{collections::HashMap, fs};
4+
use std::collections::{HashMap, HashSet};
55

66
use crate::llm_provider::execution::prompts::general_prompts::JobPromptGenerator;
77
use crate::managers::tool_router::ToolCallFunctionResponse;
@@ -92,8 +92,10 @@ impl JobPromptGenerator {
9292
if let Ok(job_scope) = job_scope {
9393
all_files.extend(job_scope);
9494
}
95-
// Add fs files and Agent files
96-
all_files.extend(additional_files);
95+
// Add fs files and Agent files, ensuring no duplicates
96+
let mut unique_files: HashSet<String> = all_files.into_iter().collect();
97+
unique_files.extend(additional_files.into_iter());
98+
all_files = unique_files.into_iter().collect();
9799

98100
if !all_files.is_empty() {
99101
prompt.add_content(
@@ -139,7 +141,8 @@ impl JobPromptGenerator {
139141
prompt.add_omni(content, image_files, SubPromptType::UserLastMessage, 100);
140142
}
141143

142-
// If function_call exists, it means that the LLM requested a function call and we need to send the response back
144+
// If function_call exists, it means that the LLM requested a function call and we need to send the response
145+
// back
143146
if let Some(function_call) = function_call {
144147
// Convert FunctionCall to Value
145148
let function_call_value = json!({

shinkai-bin/shinkai-node/src/managers/galxe_quests.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ pub async fn compute_return_for_days_quest(db: Arc<SqliteManager>, required_days
425425
let start_date = chrono::DateTime::parse_from_rfc3339("2025-02-08T00:00:00Z")
426426
.map_err(|e| format!("Failed to parse start date: {}", e))?
427427
.with_timezone(&chrono::Utc);
428-
let end_date = chrono::DateTime::parse_from_rfc3339("2025-02-20T23:59:59Z")
428+
let end_date = chrono::DateTime::parse_from_rfc3339("2025-03-06T23:59:59Z")
429429
.map_err(|e| format!("Failed to parse end date: {}", e))?
430430
.with_timezone(&chrono::Utc);
431431

@@ -545,10 +545,10 @@ pub async fn compute_use_rag_quest(db: Arc<SqliteManager>) -> Result<bool, Strin
545545
// Define the valid date range (Feb 9th to Feb 20th)
546546
let start_date = chrono::DateTime::parse_from_rfc3339("2025-02-08T00:00:00Z")
547547
.map_err(|e| format!("Failed to parse start date: {}", e))?
548-
.with_timezone(&chrono::Utc);
549-
let end_date = chrono::DateTime::parse_from_rfc3339("2025-02-20T23:59:59Z")
548+
.with_timezone(&chrono::Local);
549+
let end_date = chrono::DateTime::parse_from_rfc3339("2025-03-06T23:59:59Z")
550550
.map_err(|e| format!("Failed to parse end date: {}", e))?
551-
.with_timezone(&chrono::Utc);
551+
.with_timezone(&chrono::Local);
552552

553553
// Collect unique dates when jobs with file resources were created
554554
let mut unique_dates = std::collections::HashSet::new();
@@ -557,7 +557,7 @@ pub async fn compute_use_rag_quest(db: Arc<SqliteManager>) -> Result<bool, Strin
557557
// Parse the job's creation date
558558
let job_date = chrono::DateTime::parse_from_rfc3339(&job.datetime_created())
559559
.map_err(|e| format!("Failed to parse job date: {}", e))?
560-
.with_timezone(&chrono::Utc);
560+
.with_timezone(&chrono::Local); // Convert to local timezone
561561

562562
// Check if the job was created within the valid date range
563563
if job_date >= start_date && job_date <= end_date {

shinkai-bin/shinkai-node/src/managers/tool_router.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,10 @@ impl ToolRouter {
585585
println!("call_function additional_files: {:?}", additional_files);
586586
println!("call_function job_scope files: {:?}", all_files);
587587

588-
all_files.extend(additional_files);
588+
// Use a HashSet to ensure unique paths
589+
let mut unique_files: std::collections::HashSet<_> = all_files.into_iter().collect();
590+
unique_files.extend(additional_files.into_iter());
591+
let all_files: Vec<_> = unique_files.into_iter().collect();
589592

590593
match shinkai_tool {
591594
ShinkaiTool::Python(python_tool, _is_enabled) => {

shinkai-bin/shinkai-node/src/tools/tool_prompts.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ pub async fn generate_code_prompt(
155155
* To implement the task you can update the CONFIG, INPUTS and OUTPUT types to match the run function type:
156156
```{language}
157157
# /// script
158+
# requires-python = ">=3.10,<3.12"
158159
# dependencies = [
159160
# "requests",
160161
# ]
@@ -214,6 +215,7 @@ class OUTPUT:
214215
* This is an example of the commented script block that MUST be present before any python code or imports.
215216
216217
# /// script
218+
# requires-python = ">=3.10,<3.12"
217219
# dependencies = [
218220
# "requests",
219221
# "ruff >=0.3.0",
@@ -764,6 +766,7 @@ pub async fn tool_metadata_implementation_prompt(
764766
* If the code uses shinkaiSqliteQueryExecutor then fill the sqlTables and sqlQueries sections, otherwise these sections are empty.
765767
* sqlTables contains the complete table structures, they should be same as in the code.
766768
* sqlQueries contains from 1 to 3 examples that show how the data should be retrieved for usage.
769+
* If properties from CONFIG have default values, then those properties shouldn't be in the required array.
767770
{oauth_explain}
768771
</agent_metadata_rules>
769772

0 commit comments

Comments
 (0)