Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 29 additions & 13 deletions internal/api/user/list_prompts.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,49 @@ var defaultPrompts = []*userv1.Prompt{
// CreatedAt: timestamppb.New(time.Time{}),
// UpdatedAt: timestamppb.New(time.Time{}),
// Title: "Enhance Academic Writing (Powered by XtraGPT)",
// Content: "Suggest context-aware academic paper writing enhancements for selected text.",
// Content: "Suggest context-aware academic paper writing enhancements for the selected text.",
// IsUserPrompt: false,
// },
{
Id: "2",
CreatedAt: timestamppb.New(time.Time{}),
UpdatedAt: timestamppb.New(time.Time{}),
Title: "Review (Powered by XtraMCP)",
Content: "Review my paper and identify issues",
Title: "Search Relevant Papers (Powered by XtraMCP)",
Content: "First, understand my paper and extract the key ideas into an optimized query to find papers that are relevant to my work. Then search for relevant papers to read.\n\nOptional Args:\ntop_k: 10\nStart Date: None (e.g. 2018-12-31)\nEnd Date: None (e.g. 2025-12-31)",
IsUserPrompt: false,
},
{
Id: "3",
CreatedAt: timestamppb.New(time.Time{}),
UpdatedAt: timestamppb.New(time.Time{}),
Title: "Find Relevant Papers (Powered by XtraMCP)",
Content: "Find me relevant papers to read",
Title: "Paper Review (Powered by XtraMCP)",
Content: "Call review_paper and evaluate my paper.\n\nOptional Args:\nTarget Venue: None (e.g. ICML, NeurIPS, CVPR)\nSeverity Level (blocker | major | minor | nit): Major\nSpecific Sections (default: entire paper): None (e.g. Abstract, Results, <section name in paper>)",
IsUserPrompt: false,
},
{
Id: "4",
CreatedAt: timestamppb.New(time.Time{}),
UpdatedAt: timestamppb.New(time.Time{}),
Title: "Verify Citations (Powered by XtraMCP)",
Content: "Call verify_citations to check the validity of all citations in my paper and identify any potential issues such as incorrect formatting, missing information, or inaccurate references.",
IsUserPrompt: false,
},
{
Id: "5",
CreatedAt: timestamppb.New(time.Time{}),
UpdatedAt: timestamppb.New(time.Time{}),
Title: "Deep Research (Powered by XtraMCP)",
Content: "First, understand my paper and extract the key ideas into an optimized query. Do deep research and compare my paper against others.",
IsUserPrompt: false,
},
{
Id: "6",
CreatedAt: timestamppb.New(time.Time{}),
UpdatedAt: timestamppb.New(time.Time{}),
Title: "Online Research (Powered by XtraMCP)",
Content: "Understand my paper and run online search to find the latest papers related to my work.",
IsUserPrompt: false,
},
// {
// Id: "4",
// CreatedAt: timestamppb.New(time.Time{}),
// UpdatedAt: timestamppb.New(time.Time{}),
// Title: "Deep Research (Powered by XtraMCP)",
// Content: "Do deep research and compare my papers against others",
// IsUserPrompt: false,
// },
}

func (s *UserServer) ListPrompts(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,43 @@ import MarkdownComponent from "../../../markdown";
import { useState } from "react";
import { XtraMcpToolCardProps, parseXtraMcpToolResult, CollapseArrowButton, CollapseWrapper } from "./utils/common";

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const formatArray = (arr: any): string => {
if (Array.isArray(arr)) {
return arr.join(", ");
}
return String(arr);
// Helper function to render severity levels with strikethrough
const renderSeverityLevels = (threshold: string) => {
const levels = ['nit', 'minor', 'major', 'blocker'];
const thresholdIndex = levels.indexOf(threshold.toLowerCase());

return (
<div className="inline-flex items-center gap-1 flex-wrap">
{levels.map((level, index) => (
<span key={level}>
<code
className={cn(
"text-xs px-1.5 py-0.5 rounded",
index < thresholdIndex ? "line-through text-gray-400 bg-gray-100" : "text-gray-700 bg-gray-100"
)}
>
{level}
</code>
{index < levels.length - 1 && <span className="text-gray-400 mx-1">|</span>}
</span>
))}
</div>
);
};

const renderSections = (sections: Array<string>) => {
return (
<span>
{sections.map((section, index) => (
<span key={section}>
<code className="text-xs px-1.5 py-0.5 rounded text-gray-700 bg-gray-100">
{section}
</code>
{index < sections.length - 1 && ", "}
</span>
))}
</span>
);
};

export const ReviewPaperCard = ({ functionName, message, preparing, animated }: XtraMcpToolCardProps) => {
Expand Down Expand Up @@ -46,17 +77,11 @@ export const ReviewPaperCard = ({ functionName, message, preparing, animated }:
return (
<div className={cn("tool-card noselect narrow", { animated: animated })}>
{/* Header with Error label and arrow button */}
<div
className="flex items-center justify-between cursor-pointer"
onClick={() => setIsMetadataCollapsed(!isMetadataCollapsed)}
>
<div className="flex items-center justify-between cursor-pointer" onClick={() => setIsMetadataCollapsed(!isMetadataCollapsed)}>
<h3 className="tool-card-title">{functionName}</h3>
<div className="flex items-center gap-2">
<span className="text-red-500 text-sm font-medium">Error</span>
<CollapseArrowButton
isCollapsed={isMetadataCollapsed}
ariaLabel={isMetadataCollapsed ? "Expand error" : "Collapse error"}
/>
<CollapseArrowButton isCollapsed={isMetadataCollapsed} ariaLabel={isMetadataCollapsed ? "Expand error" : "Collapse error"} />
</div>
</div>

Expand All @@ -78,15 +103,9 @@ export const ReviewPaperCard = ({ functionName, message, preparing, animated }:
{/* COMPACT TOOL CARD - Just title + metadata dropdown */}
<div className={cn("tool-card noselect narrow", { animated: animated })}>
{/* Header with arrow button */}
<div
className="flex items-center justify-between cursor-pointer"
onClick={() => setIsMetadataCollapsed(!isMetadataCollapsed)}
>
<div className="flex items-center justify-between cursor-pointer" onClick={() => setIsMetadataCollapsed(!isMetadataCollapsed)}>
<h3 className="tool-card-title">{functionName}</h3>
<CollapseArrowButton
isCollapsed={isMetadataCollapsed}
ariaLabel={isMetadataCollapsed ? "Expand metadata" : "Collapse metadata"}
/>
<CollapseArrowButton isCollapsed={isMetadataCollapsed} ariaLabel={isMetadataCollapsed ? "Expand metadata" : "Collapse metadata"} />
</div>

{/* Metadata dropdown - INSIDE the tool card */}
Expand All @@ -104,19 +123,17 @@ export const ReviewPaperCard = ({ functionName, message, preparing, animated }:
{/* Custom metadata rendering */}
{result.metadata.target_venue !== undefined && (
<div className="mb-2">
<span className="font-medium">Checked for:</span> "
{result.metadata.target_venue || "General review"}"
<span className="font-medium">Checked for:</span> "{result.metadata.target_venue || "General review"}"
</div>
)}
{result.metadata.severity_threshold && (
<div className="mb-2">
<span className="font-medium">Filtered:</span> "{result.metadata.severity_threshold}" and above
<span className="font-medium">Filtered:</span> {renderSeverityLevels(result.metadata.severity_threshold)}
</div>
)}
{result.metadata.sections_to_review && (
{result.metadata.sections_reviewed && (
<div>
<span className="font-medium">Sections reviewed:</span>{" "}
{formatArray(result.metadata.sections_to_review)}
<span className="font-medium">Sections reviewed:</span> {renderSections(result.metadata.sections_reviewed)}
</div>
)}
</div>
Expand All @@ -126,7 +143,9 @@ export const ReviewPaperCard = ({ functionName, message, preparing, animated }:

{/* CONTENT - OUTSIDE/BELOW the tool card, always visible */}
<div className="canselect text-sm mt-2">
<MarkdownComponent animated={animated}>{result.content}</MarkdownComponent>
<MarkdownComponent animated={animated}>
{result.content}
</MarkdownComponent>
</div>
</>
);
Expand All @@ -140,4 +159,4 @@ export const ReviewPaperCard = ({ functionName, message, preparing, animated }:
</div>
</div>
);
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,31 @@ export const VerifyCitationsCard = ({ functionName, message, preparing, animated
<CollapseWrapper isCollapsed={isMetadataCollapsed}>
<div className="text-xs text-gray-600 mt-2 pt-2 border-t border-gray-200">
{/* Custom metadata rendering */}
{result.metadata.bibliography_file && (
<div className="mb-2">
<span className="font-medium">Bib source file:</span>{" "}
<code className="px-1 py-0.5 bg-gray-100 rounded text-gray-700 font-mono text-xs">
{result.metadata.bibliography_file}
</code>
</div>
)}
{result.metadata.bibliography_files && (() => {
const files = result.metadata.bibliography_files;
const isArray = Array.isArray(files);
return (
<div className="mb-2">
<span className="font-medium">Bib Source File{isArray && files.length > 1 ? 's' : ''}:</span>{" "}
{isArray ? (
<span>
{files.map((file, index) => (
<span key={file}>
<code className="px-1 py-0.5 bg-gray-100 rounded text-gray-700 font-mono text-xs">
{file}
</code>
{index < files.length - 1 && ", "}
</span>
))}
</span>
) : (
<code className="px-1 py-0.5 bg-gray-100 rounded text-gray-700 font-mono text-xs">
{files}
</code>
)}
</div>
);
})()}
{result.metadata.total_citations !== undefined && (
<div>
<span className="font-medium">Total Citations:</span> {result.metadata.total_citations}
Expand Down