Skip to content

Conversation

@ViaSocket-Git
Copy link
Collaborator

  • Added "Better Prompt" action button in test case version table for scores below 0.7
  • Integrated improvePrompt API call with conversation history and expected response
  • Implemented loading state management for prompt improvement operations
  • Added HistoryPagePromptUpdateModal to display and apply improved prompts
  • Included current prompt from bridge version configuration in selector
  • Added Action column to test case version table with

- Added "Better Prompt" action button in test case version table for scores below 0.7
- Integrated improvePrompt API call with conversation history and expected response
- Implemented loading state management for prompt improvement operations
- Added HistoryPagePromptUpdateModal to display and apply improved prompts
- Included current prompt from bridge version configuration in selector
- Added Action column to test case version table with
@cloudflare-workers-and-pages
Copy link

Deploying ai-middleware with  Cloudflare Pages  Cloudflare Pages

Latest commit: e901301
Status: ✅  Deploy successful!
Preview URL: https://87c8697c.ai-middleware.pages.dev
Branch Preview URL: https://testcaseprompt-update.ai-middleware.pages.dev

View logs

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +104 to +125
const handleBetterPrompt = async (testCase, versionId) => {
const promptKey = `${testCase._id}-${versionId}`;
setImprovingPrompts(prev => new Set([...prev, promptKey]));

try {
const variables = {};

// Get the conversation from test case
const conversation = testCase.conversation || [];

variables['prompt'] = currentPrompt;
// Add the model output as assistant response

variables["conversation_history"] = conversation;
variables["updated_response"] = testCase.expected?.response || '';

const data = await improvePrompt(variables);

if (data?.updated_prompt) {
setPromptToUpdate(data.updated_prompt);
openModal(MODAL_TYPE.HISTORY_PAGE_PROMPT_UPDATE_MODAL);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Button improves wrong version prompt

handleBetterPrompt receives the row's versionId but never uses it—currentPrompt and resolvedParams.version are used when calling improvePrompt and when showing the modal. Because the action button is rendered for every entry in the version history table, clicking it for a non‑current version will still generate and apply a prompt update to the currently selected version, potentially overwriting the wrong configuration. The prompt and version should be looked up from versionId so each row updates its own version.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants