|
195 | 195 | <p v-if="piSettingsJsonError" class="config-template-hint error-text">{{ piSettingsJsonError }}</p> |
196 | 196 | <div class="settings-tab-actions"> |
197 | 197 | <button type="button" class="btn-tool" @click="savePiSettingsJson" :disabled="!isToolConfigWriteAllowed('pi') || piSaving || piFileJsonSaving || !!piSettingsJsonError">{{ t('common.save') }}</button> |
| 198 | + <button type="button" class="btn-mini" @click="openPiConfigHistory('settings')" :disabled="piHistoryLoading">{{ t('common.history') }}</button> |
198 | 199 | </div> |
| 200 | + <details v-if="piHistoryTarget === 'settings'" class="prompt-history-panel" open> |
| 201 | + <summary class="prompt-history-summary"> |
| 202 | + <span>{{ t('common.history') }}</span> |
| 203 | + <button type="button" class="btn-mini prompt-history-close" @click="closePiConfigHistory" :title="t('common.close')">✕</button> |
| 204 | + </summary> |
| 205 | + <div class="prompt-history-body"> |
| 206 | + <ul v-if="!piHistoryLoading && !piHistoryError && piHistoryItems.length" class="prompt-history-list"> |
| 207 | + <li v-for="item in piHistoryItems" :key="item.id" :class="['prompt-history-item', { active: piHistoryPreviewId === item.id }]" @click="viewPiConfigHistoryItem(item)"> |
| 208 | + <span class="prompt-history-time">{{ item.id }}</span> |
| 209 | + <span class="prompt-history-size">{{ Math.round(item.size / 1024 * 10) / 10 }} KB</span> |
| 210 | + </li> |
| 211 | + </ul> |
| 212 | + <div v-if="piHistoryLoading" class="state-message">{{ t('diff.generating') }}</div> |
| 213 | + <div v-else-if="piHistoryError" class="state-message error">{{ piHistoryError }}</div> |
| 214 | + <div v-else-if="!piHistoryItems.length" class="state-message">{{ t('toast.history.empty') }}</div> |
| 215 | + <div v-if="piHistoryPreviewContent" class="prompt-history-preview-wrap"> |
| 216 | + <pre class="prompt-history-preview">{{ piHistoryPreviewContent }}</pre> |
| 217 | + <button type="button" class="btn-mini btn-confirm-mini" @click="applyPiConfigHistory" :disabled="piHistoryApplying || !isToolConfigWriteAllowed('pi')">{{ t('pi.history.apply') }}</button> |
| 218 | + </div> |
| 219 | + </div> |
| 220 | + </details> |
199 | 221 | <label class="form-label">{{ t('pi.files.modelsTitle') }}</label> |
200 | 222 | <textarea |
201 | 223 | class="template-textarea config-json-editor" |
|
208 | 230 | <p v-if="piModelsJsonError" class="config-template-hint error-text">{{ piModelsJsonError }}</p> |
209 | 231 | <div class="settings-tab-actions"> |
210 | 232 | <button type="button" class="btn-tool" @click="savePiModelsJson" :disabled="!isToolConfigWriteAllowed('pi') || piSaving || piFileJsonSaving || !!piModelsJsonError">{{ t('common.save') }}</button> |
| 233 | + <button type="button" class="btn-mini" @click="openPiConfigHistory('models')" :disabled="piHistoryLoading">{{ t('common.history') }}</button> |
211 | 234 | </div> |
| 235 | + <details v-if="piHistoryTarget === 'models'" class="prompt-history-panel" open> |
| 236 | + <summary class="prompt-history-summary"> |
| 237 | + <span>{{ t('common.history') }}</span> |
| 238 | + <button type="button" class="btn-mini prompt-history-close" @click="closePiConfigHistory" :title="t('common.close')">✕</button> |
| 239 | + </summary> |
| 240 | + <div class="prompt-history-body"> |
| 241 | + <ul v-if="!piHistoryLoading && !piHistoryError && piHistoryItems.length" class="prompt-history-list"> |
| 242 | + <li v-for="item in piHistoryItems" :key="item.id" :class="['prompt-history-item', { active: piHistoryPreviewId === item.id }]" @click="viewPiConfigHistoryItem(item)"> |
| 243 | + <span class="prompt-history-time">{{ item.id }}</span> |
| 244 | + <span class="prompt-history-size">{{ Math.round(item.size / 1024 * 10) / 10 }} KB</span> |
| 245 | + </li> |
| 246 | + </ul> |
| 247 | + <div v-if="piHistoryLoading" class="state-message">{{ t('diff.generating') }}</div> |
| 248 | + <div v-else-if="piHistoryError" class="state-message error">{{ piHistoryError }}</div> |
| 249 | + <div v-else-if="!piHistoryItems.length" class="state-message">{{ t('toast.history.empty') }}</div> |
| 250 | + <div v-if="piHistoryPreviewContent" class="prompt-history-preview-wrap"> |
| 251 | + <pre class="prompt-history-preview">{{ piHistoryPreviewContent }}</pre> |
| 252 | + <button type="button" class="btn-mini btn-confirm-mini" @click="applyPiConfigHistory" :disabled="piHistoryApplying || !isToolConfigWriteAllowed('pi')">{{ t('pi.history.apply') }}</button> |
| 253 | + </div> |
| 254 | + </div> |
| 255 | + </details> |
212 | 256 | </section> |
213 | 257 | <div v-if="!isToolConfigWriteAllowed('pi')" class="tool-config-write-overlay"> |
214 | 258 | <div class="tool-config-write-overlay-card"> |
|
0 commit comments