Skip to content

Commit

Permalink
use SettingsManager.get_settings().PROMPT_CACHE_WINDOW_HOURS
Browse files Browse the repository at this point in the history
  • Loading branch information
wintonzheng committed Sep 3, 2024
1 parent 0d39e62 commit 91fd886
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion skyvern/forge/sdk/db/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ async def create_task_generation(
async def get_task_generation_by_prompt_hash(
self,
user_prompt_hash: str,
query_window_hours: int = settings.PROMPT_ACTION_HISTORY_WINDOW,
query_window_hours: int = settings.PROMPT_CACHE_WINDOW_HOURS,
) -> TaskGeneration | None:
before_time = datetime.utcnow() - timedelta(hours=query_window_hours)
async with self.Session() as session:
Expand Down
3 changes: 1 addition & 2 deletions skyvern/forge/sdk/routes/agent_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
base_router = APIRouter()

LOG = structlog.get_logger()
PROMPT_CACHE_WINDOW_HOURS = 24


@base_router.post("/webhook", tags=["server"])
Expand Down Expand Up @@ -775,7 +774,7 @@ async def generate_task(
# check if there's a same user_prompt within the past x Hours
# in the future, we can use vector db to fetch similar prompts
existing_task_generation = await app.DATABASE.get_task_generation_by_prompt_hash(
user_prompt_hash=user_prompt_hash, query_window_hours=PROMPT_CACHE_WINDOW_HOURS
user_prompt_hash=user_prompt_hash, query_window_hours=SettingsManager.get_settings().PROMPT_CACHE_WINDOW_HOURS
)
if existing_task_generation:
new_task_generation = await app.DATABASE.create_task_generation(
Expand Down

0 comments on commit 91fd886

Please sign in to comment.