modified: astrbot/core/pipeline/process_stage/method/llm_request.py

new file:   astrbot/core/star/session_llm_manager.py
	modified:   astrbot/dashboard/routes/session_management.py
	modified:   dashboard/src/views/SessionManagementPage.vue

 增加了精确到会话的LLM启停管理以及插件启停管理
This commit is contained in:
advent259141
2025-06-14 03:42:21 +08:00
parent f26cf6ed6f
commit bfc8024119
4 changed files with 175 additions and 9 deletions
+53 -5
View File
@@ -154,7 +154,25 @@
{{ selection.raw.label }}
</v-chip>
</template>
</v-select>
</v-select> </template>
<!-- LLM启停 -->
<template v-slot:item.llm_enabled="{ item }">
<v-switch
:model-value="item.llm_enabled"
@update:model-value="(value) => updateLLM(item, value)"
:loading="item.updating"
hide-details
density="compact"
color="primary"
inset
>
<template v-slot:label>
<span class="text-caption">
{{ item.llm_enabled ? '已启用' : '已禁用' }}
</span>
</template>
</v-switch>
</template>
<!-- 插件管理 -->
@@ -307,8 +325,7 @@
</v-chip>
</v-list-item-subtitle>
</v-list-item>
<v-list-item v-if="selectedSession.tts_provider_name">
<v-list-item v-if="selectedSession.tts_provider_name">
<v-list-item-title>TTS Provider</v-list-item-title>
<v-list-item-subtitle>
<v-chip size="small" color="warning">
@@ -316,6 +333,18 @@
</v-chip>
</v-list-item-subtitle>
</v-list-item>
<v-list-item>
<v-list-item-title>LLM状态</v-list-item-title>
<v-list-item-subtitle>
<v-chip
size="small"
:color="selectedSession.llm_enabled ? 'success' : 'error'"
>
{{ selectedSession.llm_enabled ? '已启用' : '已禁用' }}
</v-chip>
</v-list-item-subtitle>
</v-list-item>
</v-list>
</v-card-text>
</v-card>
@@ -424,14 +453,14 @@ export default {
snackbar: false,
snackbarText: '',
snackbarColor: 'success',
// 表格头部
// 表格头部
headers: [
{ title: '会话信息', key: 'session_info', sortable: false, width: '200px' },
{ title: '人格', key: 'persona', sortable: false, width: '180px' },
{ title: 'Chat Provider', key: 'chat_provider', sortable: false, width: '180px' },
{ title: 'STT Provider', key: 'stt_provider', sortable: false, width: '150px' },
{ title: 'TTS Provider', key: 'tts_provider', sortable: false, width: '150px' },
{ title: 'LLM启停', key: 'llm_enabled', sortable: false, width: '120px' },
{ title: '插件管理', key: 'plugins', sortable: false, width: '120px' },
{ title: '操作', key: 'actions', sortable: false, width: '80px' },
],
@@ -585,6 +614,25 @@ export default {
}
} catch (error) {
this.showError(error.response?.data?.message || 'Provider 更新失败');
} session.updating = false;
},
async updateLLM(session, enabled) {
session.updating = true;
try {
const response = await axios.post('/api/session/update_llm', {
session_id: session.session_id,
enabled: enabled
});
if (response.data.status === 'ok') {
session.llm_enabled = enabled;
this.showSuccess(`LLM ${enabled ? '已启用' : '已禁用'}`);
} else {
this.showError(response.data.message || 'LLM状态更新失败');
}
} catch (error) {
this.showError(error.response?.data?.message || 'LLM状态更新失败');
}
session.updating = false;
},