|
@@ -23,6 +23,8 @@ import { SearchableSetting } from "./SearchableSetting"
|
|
|
interface PromptsSettingsProps {
|
|
interface PromptsSettingsProps {
|
|
|
customSupportPrompts: Record<string, string | undefined>
|
|
customSupportPrompts: Record<string, string | undefined>
|
|
|
setCustomSupportPrompts: (prompts: Record<string, string | undefined>) => void
|
|
setCustomSupportPrompts: (prompts: Record<string, string | undefined>) => void
|
|
|
|
|
+ customCondensingPrompt?: string
|
|
|
|
|
+ setCustomCondensingPrompt?: (value: string) => void
|
|
|
includeTaskHistoryInEnhance?: boolean
|
|
includeTaskHistoryInEnhance?: boolean
|
|
|
setIncludeTaskHistoryInEnhance?: (value: boolean) => void
|
|
setIncludeTaskHistoryInEnhance?: (value: boolean) => void
|
|
|
}
|
|
}
|
|
@@ -30,6 +32,8 @@ interface PromptsSettingsProps {
|
|
|
const PromptsSettings = ({
|
|
const PromptsSettings = ({
|
|
|
customSupportPrompts,
|
|
customSupportPrompts,
|
|
|
setCustomSupportPrompts,
|
|
setCustomSupportPrompts,
|
|
|
|
|
+ customCondensingPrompt: propsCustomCondensingPrompt,
|
|
|
|
|
+ setCustomCondensingPrompt: propsSetCustomCondensingPrompt,
|
|
|
includeTaskHistoryInEnhance: propsIncludeTaskHistoryInEnhance,
|
|
includeTaskHistoryInEnhance: propsIncludeTaskHistoryInEnhance,
|
|
|
setIncludeTaskHistoryInEnhance: propsSetIncludeTaskHistoryInEnhance,
|
|
setIncludeTaskHistoryInEnhance: propsSetIncludeTaskHistoryInEnhance,
|
|
|
}: PromptsSettingsProps) => {
|
|
}: PromptsSettingsProps) => {
|
|
@@ -40,12 +44,16 @@ const PromptsSettings = ({
|
|
|
setEnhancementApiConfigId,
|
|
setEnhancementApiConfigId,
|
|
|
condensingApiConfigId,
|
|
condensingApiConfigId,
|
|
|
setCondensingApiConfigId,
|
|
setCondensingApiConfigId,
|
|
|
- customCondensingPrompt,
|
|
|
|
|
- setCustomCondensingPrompt,
|
|
|
|
|
|
|
+ customCondensingPrompt: contextCustomCondensingPrompt,
|
|
|
|
|
+ setCustomCondensingPrompt: contextSetCustomCondensingPrompt,
|
|
|
includeTaskHistoryInEnhance: contextIncludeTaskHistoryInEnhance,
|
|
includeTaskHistoryInEnhance: contextIncludeTaskHistoryInEnhance,
|
|
|
setIncludeTaskHistoryInEnhance: contextSetIncludeTaskHistoryInEnhance,
|
|
setIncludeTaskHistoryInEnhance: contextSetIncludeTaskHistoryInEnhance,
|
|
|
} = useExtensionState()
|
|
} = useExtensionState()
|
|
|
|
|
|
|
|
|
|
+ // Use props if provided, otherwise fall back to context
|
|
|
|
|
+ const customCondensingPrompt = propsCustomCondensingPrompt ?? contextCustomCondensingPrompt
|
|
|
|
|
+ const setCustomCondensingPrompt = propsSetCustomCondensingPrompt ?? contextSetCustomCondensingPrompt
|
|
|
|
|
+
|
|
|
// Use props if provided, otherwise fall back to context
|
|
// Use props if provided, otherwise fall back to context
|
|
|
const includeTaskHistoryInEnhance = propsIncludeTaskHistoryInEnhance ?? contextIncludeTaskHistoryInEnhance ?? true
|
|
const includeTaskHistoryInEnhance = propsIncludeTaskHistoryInEnhance ?? contextIncludeTaskHistoryInEnhance ?? true
|
|
|
const setIncludeTaskHistoryInEnhance = propsSetIncludeTaskHistoryInEnhance ?? contextSetIncludeTaskHistoryInEnhance
|
|
const setIncludeTaskHistoryInEnhance = propsSetIncludeTaskHistoryInEnhance ?? contextSetIncludeTaskHistoryInEnhance
|
|
@@ -76,10 +84,6 @@ const PromptsSettings = ({
|
|
|
|
|
|
|
|
if (type === "CONDENSE") {
|
|
if (type === "CONDENSE") {
|
|
|
setCustomCondensingPrompt(finalValue ?? supportPrompt.default.CONDENSE)
|
|
setCustomCondensingPrompt(finalValue ?? supportPrompt.default.CONDENSE)
|
|
|
- vscode.postMessage({
|
|
|
|
|
- type: "updateCondensingPrompt",
|
|
|
|
|
- text: finalValue ?? supportPrompt.default.CONDENSE,
|
|
|
|
|
- })
|
|
|
|
|
// Also update the customSupportPrompts to trigger change detection
|
|
// Also update the customSupportPrompts to trigger change detection
|
|
|
const updatedPrompts = { ...customSupportPrompts }
|
|
const updatedPrompts = { ...customSupportPrompts }
|
|
|
if (finalValue === undefined) {
|
|
if (finalValue === undefined) {
|
|
@@ -102,10 +106,6 @@ const PromptsSettings = ({
|
|
|
const handleSupportReset = (type: SupportPromptType) => {
|
|
const handleSupportReset = (type: SupportPromptType) => {
|
|
|
if (type === "CONDENSE") {
|
|
if (type === "CONDENSE") {
|
|
|
setCustomCondensingPrompt(supportPrompt.default.CONDENSE)
|
|
setCustomCondensingPrompt(supportPrompt.default.CONDENSE)
|
|
|
- vscode.postMessage({
|
|
|
|
|
- type: "updateCondensingPrompt",
|
|
|
|
|
- text: supportPrompt.default.CONDENSE,
|
|
|
|
|
- })
|
|
|
|
|
// Also update the customSupportPrompts to trigger change detection
|
|
// Also update the customSupportPrompts to trigger change detection
|
|
|
const updatedPrompts = { ...customSupportPrompts }
|
|
const updatedPrompts = { ...customSupportPrompts }
|
|
|
delete updatedPrompts[type]
|
|
delete updatedPrompts[type]
|