feat: redact file contents from chat and put latest files into system prompt (#904)

This commit is contained in:
Anirban Kar
2024-12-29 15:36:31 +05:30
committed by GitHub
parent aecd9b1b40
commit 3a36a4469a
6 changed files with 50 additions and 9 deletions

View File

@@ -118,7 +118,7 @@ export const ChatImpl = memo(
const [searchParams, setSearchParams] = useSearchParams();
const files = useStore(workbenchStore.files);
const actionAlert = useStore(workbenchStore.alert);
const { activeProviders, promptId } = useSettings();
const { activeProviders, promptId, contextOptimizationEnabled } = useSettings();
const [model, setModel] = useState(() => {
const savedModel = Cookies.get('selectedModel');
@@ -141,6 +141,7 @@ export const ChatImpl = memo(
apiKeys,
files,
promptId,
contextOptimization: contextOptimizationEnabled,
},
sendExtraMessageFields: true,
onError: (error) => {

View File

@@ -14,6 +14,8 @@ export default function FeaturesTab() {
enableLatestBranch,
promptId,
setPromptId,
enableContextOptimization,
contextOptimizationEnabled,
} = useSettings();
const handleToggle = (enabled: boolean) => {
@@ -39,6 +41,19 @@ export default function FeaturesTab() {
</div>
<Switch className="ml-auto" checked={isLatestBranch} onCheckedChange={enableLatestBranch} />
</div>
<div className="flex items-center justify-between">
<div>
<span className="text-bolt-elements-textPrimary">Use Context Optimization</span>
<p className="text-sm text-bolt-elements-textSecondary">
redact file contents form chat and puts the latest file contents on the system prompt
</p>
</div>
<Switch
className="ml-auto"
checked={contextOptimizationEnabled}
onCheckedChange={enableContextOptimization}
/>
</div>
</div>
</div>