-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Update packages #1061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update packages #1061
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,12 +68,22 @@ function selectModel( | |
| switch (aiProvider) { | ||
| case Provider.OPEN_AI: { | ||
| const modelName = aiModel || "gpt-5.1"; | ||
| // When Zero Data Retention is enabled, set store: false to avoid | ||
| // "Items are not persisted for Zero Data Retention organizations" errors | ||
| // See: https://github.com/vercel/ai/issues/10060 | ||
| const openAiProviderOptions = env.OPENAI_ZERO_DATA_RETENTION | ||
| ? { | ||
| ...providerOptions, | ||
| openai: { ...providerOptions?.openai, store: false }, | ||
| } | ||
| : providerOptions; | ||
| return { | ||
|
Comment on lines
+71
to
80
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prevent runtime error when
const openAiProviderOptions = env.OPENAI_ZERO_DATA_RETENTION
? {
...providerOptions,
openai: { ...providerOptions?.openai, store: false },
}
: providerOptions;If You can avoid this by normalizing to an empty object before spreading: - case Provider.OPEN_AI: {
+ case Provider.OPEN_AI: {
const modelName = aiModel || "gpt-5.1";
- // When Zero Data Retention is enabled, set store: false to avoid
- // "Items are not persisted for Zero Data Retention organizations" errors
- // See: https://github.com/vercel/ai/issues/10060
- const openAiProviderOptions = env.OPENAI_ZERO_DATA_RETENTION
- ? {
- ...providerOptions,
- openai: { ...providerOptions?.openai, store: false },
- }
- : providerOptions;
+ // When Zero Data Retention is enabled, set store: false to avoid
+ // "Items are not persisted for Zero Data Retention organizations" errors
+ // See: https://github.com/vercel/ai/issues/10060
+ const baseOptions = providerOptions ?? {};
+ const openAiProviderOptions = env.OPENAI_ZERO_DATA_RETENTION
+ ? {
+ ...baseOptions,
+ openai: { ...(baseOptions.openai ?? {}), store: false },
+ }
+ : providerOptions;
return {
provider: Provider.OPEN_AI,
modelName,
model: createOpenAI({ apiKey: aiApiKey || env.OPENAI_API_KEY })(
modelName,
),
- providerOptions: openAiProviderOptions,
+ providerOptions: openAiProviderOptions,
backupModel: getBackupModel(aiApiKey),
};
}This keeps behavior unchanged when the flag is false and avoids crashes when it’s true. Also applies to: 86-86 🤖 Prompt for AI Agents |
||
| provider: Provider.OPEN_AI, | ||
| modelName, | ||
| model: createOpenAI({ apiKey: aiApiKey || env.OPENAI_API_KEY })( | ||
| modelName, | ||
| ), | ||
| providerOptions: openAiProviderOptions, | ||
| backupModel: getBackupModel(aiApiKey), | ||
| }; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,9 @@ import { SafeError } from "@/utils/error"; | |||||
|
|
||||||
| const logger = createScopedLogger("outlook/client"); | ||||||
|
|
||||||
| // Add buffer time to prevent token expiry during long-running operations | ||||||
| const TOKEN_REFRESH_BUFFER_MS = 10 * 60 * 1000; // 10 minutes | ||||||
|
|
||||||
| // Wrapper class to hold both the Microsoft Graph client and its access token | ||||||
| export class OutlookClient { | ||||||
| private readonly client: Client; | ||||||
|
|
@@ -97,7 +100,11 @@ export const getOutlookClientWithRefresh = async ({ | |||||
|
|
||||||
| // Check if token needs refresh | ||||||
| const expiryDate = expiresAt ? expiresAt : null; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The expiry check mixes seconds ( - const expiryDate = expiresAt ? expiresAt : null;
+ const expiryDateMs = expiresAt ? expiresAt * 1000 : null;
if (
- accessToken &&
- expiryDate &&
- expiryDate > Date.now() + TOKEN_REFRESH_BUFFER_MS
+ accessToken &&
+ expiryDateMs &&
+ expiryDateMs > Date.now() + TOKEN_REFRESH_BUFFER_MS
) {
return createOutlookClient(accessToken);
}
|
||||||
| if (accessToken && expiryDate && expiryDate > Date.now()) { | ||||||
| if ( | ||||||
| accessToken && | ||||||
| expiryDate && | ||||||
| expiryDate > Date.now() + TOKEN_REFRESH_BUFFER_MS | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Prompt for AI agents
Suggested change
|
||||||
| ) { | ||||||
| return createOutlookClient(accessToken); | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| v2.21.34 | ||
| v2.21.37 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue on line in
apps/web/utils/llms/model.ts:153:Suggestion: Add defensive checks/defaults in
apps/web/utils/llms/model.tsbefore provider construction—validateenv.BEDROCK_ACCESS_KEY/env.BEDROCK_SECRET_KEYand defaultproviderOptions/providerOptions.openaito empty objects—to prevent runtime errors.