feat: exclude 'Deprecated' plans (and their tasks) from LLM context
All checks were successful
Build and Deploy Teams Planner Bot / build-and-run (push) Successful in 30s
All checks were successful
Build and Deploy Teams Planner Bot / build-and-run (push) Successful in 30s
This commit is contained in:
parent
e42b3d7c43
commit
59c6814ccc
@ -170,6 +170,11 @@ export class PlannerBot extends TeamsActivityHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// listPlansWithBuckets already drops "Deprecated" plans; mirror that for tasks
|
||||||
|
// so the LLM can't try to update a task in a hidden plan.
|
||||||
|
const validPlanIds = new Set(plans.map((p) => p.planId));
|
||||||
|
recentTasks = recentTasks.filter((t) => validPlanIds.has(t.planId));
|
||||||
|
|
||||||
const action = await this.classifier.classify({
|
const action = await this.classifier.classify({
|
||||||
utterance,
|
utterance,
|
||||||
plans,
|
plans,
|
||||||
|
|||||||
@ -11,12 +11,17 @@ import { PlanContext, Progress, RecentTaskContext } from "../llm/types";
|
|||||||
export class PlannerClient {
|
export class PlannerClient {
|
||||||
constructor(private readonly graph: Client) {}
|
constructor(private readonly graph: Client) {}
|
||||||
|
|
||||||
/** All plans the signed-in user can see, with their buckets pre-fetched. */
|
/** All plans the signed-in user can see, with their buckets pre-fetched.
|
||||||
|
* Plans whose title contains "deprecated" (case-insensitive) are filtered out
|
||||||
|
* so old/archived plans don't pollute the LLM context.
|
||||||
|
*/
|
||||||
async listPlansWithBuckets(): Promise<PlanContext[]> {
|
async listPlansWithBuckets(): Promise<PlanContext[]> {
|
||||||
// Plans this user can access via the groups they belong to.
|
// Plans this user can access via the groups they belong to.
|
||||||
// Graph exposes /me/planner/plans which returns plans for groups the user is a member of.
|
// Graph exposes /me/planner/plans which returns plans for groups the user is a member of.
|
||||||
const plansResp = await this.graph.api("/me/planner/plans").get();
|
const plansResp = await this.graph.api("/me/planner/plans").get();
|
||||||
const plans: Array<{ id: string; title: string }> = plansResp.value ?? [];
|
const plans: Array<{ id: string; title: string }> = (plansResp.value ?? []).filter(
|
||||||
|
(p: { title?: string }) => !/deprecated/i.test(p.title ?? ""),
|
||||||
|
);
|
||||||
|
|
||||||
const result: PlanContext[] = [];
|
const result: PlanContext[] = [];
|
||||||
for (const p of plans) {
|
for (const p of plans) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user