This commit is contained in:
seb
2026-10-05 19:04:13 +02:00
parent 863ff20733
commit 1c6f4e6706
2 changed files with 77 additions and 8 deletions

View File

@@ -28,6 +28,9 @@ const SETTABLE_KEYS = [
'keys.tavily',
'keys.openrouter',
'keys.serper',
'default-model',
'systemprompt-prefix',
'systemprompt-suffix',
];
const KEY_LABELS = {
@@ -35,8 +38,21 @@ const KEY_LABELS = {
'keys.tavily': 'Tavily API-Key',
'keys.openrouter': 'OpenRouter API-Key',
'keys.serper': 'Serper API-Key',
'default-model': 'Modellslug',
'systemprompt-prefix': 'Prä Prompt',
'systemprompt-suffix': 'Post Prompt',
};
const MULTILINE_KEYS = new Set([
'systemprompt-prefix',
'systemprompt-suffix',
]);
const EXCLUDED_KEYS = new Set([
'labelprinter.addr',
'labelprinter.type',
]);
function keyLabel(key) {
return KEY_LABELS[key] ?? key;
}
@@ -177,25 +193,43 @@ export default class SettingsKeysPanel extends Component {
<TableContainer>
<Table size="small">
<TableBody>
{SETTABLE_KEYS.map((key) => {
{SETTABLE_KEYS.filter((k) => !EXCLUDED_KEYS.has(k)).map((key) => {
const row = settings.find((s) => s.key === key);
const draft = row ? drafts[row.key] : null;
if (!row || !draft) return null;
const isMultiline = MULTILINE_KEYS.has(row.key);
return (
<TableRow key={row.key} hover>
<TableCell>
<TableCell
sx={{
width: 180,
verticalAlign: 'top',
pt: 1.5,
whiteSpace: 'nowrap',
}}
>
<Typography variant="body2">{keyLabel(row.key)}</Typography>
</TableCell>
<TableCell>
<TableCell sx={{ verticalAlign: 'top' }}>
<TextField
size="small"
fullWidth
multiline={isMultiline}
minRows={isMultiline ? 2 : undefined}
maxRows={isMultiline ? 6 : undefined}
value={draft.value}
disabled={draft.busy}
onChange={(e) => this.handleChange(row.key, 'value', e.target.value)}
onKeyDown={(e) => {
if (!isMultiline && e.key === 'Enter') {
e.preventDefault();
void this.handleSave(row.key);
}
}}
autoComplete="off"
/>
</TableCell>
<TableCell align="right">
<TableCell align="right" sx={{ verticalAlign: 'top', pt: 1, width: 60 }}>
<Stack
direction="row"
spacing={0}