feat: 添加对话应用选择和知识库切换功能
- 新增对话应用管理模块(dify-chat-apps),支持获取和切换对话应用 - 优化对话应用切换后自动刷新会话列表功能 - 知识库管理页面新增下拉选择器,支持切换不同知识库 - API 层支持 app_id 参数传递,实现多应用会话隔离 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -65,9 +65,9 @@ export default function AreaDatasetConfig() {
|
||||
areas,
|
||||
// areasLoading, // 地区列表已加载hook中
|
||||
|
||||
// 筛选
|
||||
filterArea,
|
||||
setFilterArea,
|
||||
// 筛选 - 多选
|
||||
filterAreas,
|
||||
setFilterAreas,
|
||||
page,
|
||||
setPage,
|
||||
pageSize,
|
||||
@@ -233,24 +233,17 @@ export default function AreaDatasetConfig() {
|
||||
};
|
||||
|
||||
/**
|
||||
* 处理地区筛选变化
|
||||
* 处理地区筛选变化 - 支持多选
|
||||
*/
|
||||
const handleAreaFilterChange = (value: string) => {
|
||||
setFilterArea(value);
|
||||
const handleAreaFilterChange = (values: string[]) => {
|
||||
setFilterAreas(values);
|
||||
setPage(1); // 重置到第一页
|
||||
};
|
||||
|
||||
// ==================== Render ====================
|
||||
|
||||
// 计算用户角色标签
|
||||
const userRoleLabel = (() => {
|
||||
const labels: Record<string, string> = {
|
||||
common: '普通用户',
|
||||
admin: '市级管理员',
|
||||
provincial_admin: '省级管理员',
|
||||
};
|
||||
return labels[userRole] || '未知角色';
|
||||
})();
|
||||
// 用户角色已经在 hook 中处理好了,直接使用 userRole
|
||||
const userRoleLabel = userRole || '未知角色';
|
||||
|
||||
// 表格列定义
|
||||
const columns = [
|
||||
@@ -456,16 +449,15 @@ export default function AreaDatasetConfig() {
|
||||
<Flex gap="16px" align="center">
|
||||
<Text style={{ color: colors.text }}>地区筛选:</Text>
|
||||
<Select
|
||||
style={{ width: '150px' }}
|
||||
placeholder="全部地区"
|
||||
mode="multiple"
|
||||
style={{ minWidth: '200px', maxWidth: '400px' }}
|
||||
placeholder="请选择地区(可多选)"
|
||||
allowClear
|
||||
value={filterArea || undefined}
|
||||
value={filterAreas}
|
||||
onChange={handleAreaFilterChange}
|
||||
options={[
|
||||
{ label: '全部', value: '' },
|
||||
{ label: '省级', value: '省级' },
|
||||
...areas.map((area) => ({ label: area, value: area })),
|
||||
]}
|
||||
maxTagCount={3}
|
||||
maxTagPlaceholder={(omittedValues) => `+${omittedValues.length}个`}
|
||||
options={Array.isArray(areas) ? areas.map((area) => ({ label: area, value: area })) : []}
|
||||
/>
|
||||
</Flex>
|
||||
</Card>
|
||||
@@ -538,10 +530,10 @@ export default function AreaDatasetConfig() {
|
||||
<Select
|
||||
placeholder="请选择地区"
|
||||
disabled={!!editingId} // 编辑时禁用
|
||||
options={areas.map((area) => ({
|
||||
options={Array.isArray(areas) ? areas.map((area) => ({
|
||||
label: area,
|
||||
value: area,
|
||||
}))}
|
||||
})) : []}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user