-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Restore recipe parameters functionality #3530
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
Changes from 4 commits
66ae443
8e145d3
97732f3
135ad72
e7f8b58
7bba69d
17db8ee
4e1988c
520f448
4644484
4863743
4e8363c
353baf3
66dc3a5
67ebebc
91291e2
73017ae
1dbb5fd
893c2a0
0d603a0
1a0cd8c
8b4fd1d
c8dc5f6
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 |
|---|---|---|
|
|
@@ -273,6 +273,10 @@ export type ModelInfo = { | |
| * Cost per token for output (optional) | ||
| */ | ||
| output_token_cost?: number | null; | ||
| /** | ||
|
Collaborator
Author
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. upstream changes can ignore
Collaborator
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. should we maybe have something in CI that checks whether regenerating the openapi.json is a no-op?
Collaborator
Author
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. Not sure if ci can help this other than maybe flagging when someone didn't manually generate it? It should be manually generated whenever someone makes a related change. I run the full
Collaborator
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. yeah, I meant we could run the typegen in ci and compare if it changes anything and if it does, tell the user they forgot to run it but did make a change
Collaborator
Author
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. Ah gotcha, good idea! Will follow up with that 👍 |
||
| * Whether this model supports cache control | ||
| */ | ||
| supports_cache_control?: boolean | null; | ||
| }; | ||
|
|
||
| export type PermissionConfirmationRequest = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,7 @@ export interface ChatType { | |
| messageHistoryIndex: number; | ||
| messages: Message[]; | ||
| recipeConfig?: Recipe | null; // Add recipe configuration to chat state | ||
| recipeParameters?: Record<string, string> | null; // Add recipe parameters to chat state | ||
| } | ||
|
|
||
| interface BaseChatProps { | ||
|
|
@@ -200,16 +201,25 @@ function BaseChatContent({ | |
| // Reset recipe usage tracking when recipe changes | ||
| useEffect(() => { | ||
| if (recipeConfig?.title !== currentRecipeTitle) { | ||
| const previousTitle = currentRecipeTitle; | ||
|
||
| setCurrentRecipeTitle(recipeConfig?.title || null); | ||
| setHasStartedUsingRecipe(false); | ||
|
|
||
| // Clear existing messages when a new recipe is loaded | ||
| if (recipeConfig?.title && recipeConfig.title !== currentRecipeTitle) { | ||
| // Only reset usage if we're switching between different recipes | ||
| // Don't reset if we're going from no recipe to a recipe (initial load) | ||
| // or if we already have messages (ongoing conversation) | ||
|
||
| if (previousTitle && recipeConfig?.title && previousTitle !== recipeConfig.title) { | ||
|
||
| console.log('Switching from recipe:', previousTitle, 'to:', recipeConfig.title); | ||
| setHasStartedUsingRecipe(false); | ||
| setMessages([]); | ||
| setAncestorMessages([]); | ||
| } else if (!previousTitle && recipeConfig?.title && messages.length === 0) { | ||
| setHasStartedUsingRecipe(false); | ||
| // Only clear messages if we don't have any yet | ||
| } else if (recipeConfig?.title && messages.length > 0) { | ||
| setHasStartedUsingRecipe(true); // Mark as started since we have messages | ||
| } | ||
| } | ||
| }, [recipeConfig?.title, currentRecipeTitle, setMessages, setAncestorMessages]); | ||
| }, [recipeConfig?.title, currentRecipeTitle, messages.length, setMessages, setAncestorMessages]); | ||
|
|
||
| // Handle recipe auto-execution | ||
| useEffect(() => { | ||
|
|
@@ -421,29 +431,6 @@ function BaseChatContent({ | |
| {error.message || 'Honk! Goose experienced an error while responding'} | ||
| </div> | ||
|
|
||
| {/* Expandable Error Details */} | ||
|
Collaborator
Author
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. Removed this expandable error details area as it wasn't providing any other useful context than what is displayed on the screen. |
||
| <details className="w-full max-w-2xl mb-2"> | ||
| <summary className="text-xs text-textSubtle cursor-pointer hover:text-textStandard transition-colors"> | ||
| Error details | ||
| </summary> | ||
| <div className="mt-2 p-3 bg-bgSubtle border border-borderSubtle rounded-lg text-xs font-mono text-textStandard"> | ||
| <div className="mb-2"> | ||
| <strong>Error Type:</strong> {error.name || 'Unknown'} | ||
| </div> | ||
| <div className="mb-2"> | ||
| <strong>Message:</strong> {error.message || 'No message'} | ||
| </div> | ||
| {error.stack && ( | ||
| <div> | ||
| <strong>Stack Trace:</strong> | ||
| <pre className="mt-1 whitespace-pre-wrap text-xs overflow-x-auto"> | ||
| {error.stack} | ||
| </pre> | ||
| </div> | ||
| )} | ||
| </div> | ||
| </details> | ||
|
|
||
| {/* Regular retry button for non-token-limit errors */} | ||
| <div | ||
| className="px-3 py-2 mt-2 text-center whitespace-nowrap cursor-pointer text-textStandard border border-borderSubtle hover:bg-bgSubtle rounded-full inline-block transition-all duration-150" | ||
|
|
||
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.
upstream changes can ignore