Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ui/src/api/API_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ API 枚举与类型统一在 `src/api` 范围内管理,相关规则由本文
- 同一业务边界内的重复类型提取到最近共同目录的 `common.ts``common.ts` 不得成为无关类型
的集合。
- API 与 View 或 Component 使用同一业务类型时只保留一份声明,不得在两层分别定义。
- 智能体详情及保存参数中的 `default_model_setting` 共用模型类别 `DefaultModelType` 和单项
配置 `ModelConfig``types/model.ts`),工作流页面及设置抽屉从 `@/api/types` 引用。
- 智能体详情及保存参数中的 `default_model_setting` 使用 `DefaultModelSettingPayload`;该类型由
`DefaultModelType` 和单项配置 `ModelConfig` 组合而成(`types/model.ts`),工作流页面及设置抽屉
`@/api/types` 引用。
- 名称相同但业务含义或字段约束不同的类型不要强行合并,应使用明确的领域名称区分。
- 使用 `interface` 描述对象结构,使用 `type` 描述联合类型、交叉类型、工具类型结果或别名。
- 类型名称必须体现业务含义,避免使用 `Data``Item``Info` 等脱离领域后含义不清的名称。
Expand Down
2 changes: 0 additions & 2 deletions ui/src/api/admin/system/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ import type { CreateWorkspaceMemberPayload, Dict, WorkspaceItem, WorkspaceMember
const prefix = '/system/workspace'

/** 首页头部工作空间列表 | 系统管理的工作空间模块 */
// TODO 工作空间管理员接口 /workspace 未区分
const getSystemWorkspaceList = () => {
return get<WorkspaceItem[]>(prefix)
}

/** 获取工作空间成员列表 **/
// TODO 工作空间管理员接口 /workspace 未区分

const getWorkspaceMemberList = (workspace_id: string, page: ParamsPage, query?: Dict<unknown>) => {
return get<ResponsePage<WorkspaceMemberItem>>(`${prefix}/${workspace_id}/user_list/${page.currentPage}/${page.pageSize}`, query)
Expand Down
6 changes: 3 additions & 3 deletions ui/src/api/types/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import type LogicFlow from '@logicflow/core'
import { APPLICATION_TYPE } from '@/api/enums'
import type { DefaultModelType, ModelConfig } from './model'
import type { DefaultModelSettingPayload } from './model'

export type ApplicationType = (typeof APPLICATION_TYPE)[keyof typeof APPLICATION_TYPE]

export interface ApplicationDetail {
default_model_setting?: Partial<Record<DefaultModelType, ModelConfig>>
default_model_setting?: DefaultModelSettingPayload
create_time?: string
desc?: string | null
folder?: string
Expand All @@ -29,7 +29,7 @@ export interface ApplicationDetail {
}

export interface ApplicationFormPayload {
default_model_setting?: ApplicationDetail['default_model_setting']
default_model_setting?: DefaultModelSettingPayload
name?: string
desc?: string
model_id?: string
Expand Down
21 changes: 21 additions & 0 deletions ui/src/api/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,24 @@ export interface CommonUserOption {
nick_name: string
roles?: string[]
}


export interface DynamicFormField {
attrs?: Record<string, unknown>
default_value?: unknown
field: string
input_type: string
label: string | DynamicFormLabel
option_list?: Record<string, unknown>[]
required?: boolean
text_field?: string
value_field?: string
[key: string]: unknown
}

export interface DynamicFormLabel {
attrs?: { tooltip?: string; [key: string]: unknown }
input_type: string
label: string
type?: string
}
23 changes: 3 additions & 20 deletions ui/src/api/types/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { MODEL_STATUS } from '@/api/enums'
import type { Dict } from './common'
import type { DynamicFormField } from './common'

export type ModelStatus = (typeof MODEL_STATUS)[keyof typeof MODEL_STATUS]

Expand All @@ -13,6 +14,8 @@ export interface ModelConfig {
model_params_setting?: Dict<unknown>
}

export type DefaultModelSettingPayload = Partial<Record<DefaultModelType, ModelConfig>>

export interface ModelProviderItem {
icon: string
name: string
Expand Down Expand Up @@ -49,26 +52,6 @@ export interface ModelPayload {
provider: string
}

export interface DynamicFormField {
attrs?: Record<string, unknown>
default_value?: unknown
field: string
input_type: string
label: string | DynamicFormLabel
option_list?: Record<string, unknown>[]
required?: boolean
text_field?: string
value_field?: string
[key: string]: unknown
}

export interface DynamicFormLabel {
attrs?: { tooltip?: string; [key: string]: unknown }
input_type: string
label: string
type?: string
}

export interface BaseModelOption {
desc?: string
model_type: string
Expand Down
2 changes: 1 addition & 1 deletion ui/src/api/types/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import type LogicFlow from '@logicflow/core'
import { TOOL_SCOPE, TOOL_TYPE } from '@/api/enums'
import type { DynamicFormField } from './model'
import type { DynamicFormField } from './common'

export type ToolScope = (typeof TOOL_SCOPE)[keyof typeof TOOL_SCOPE]
export type ToolType = (typeof TOOL_TYPE)[keyof typeof TOOL_TYPE]
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/iconfont.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions ui/src/assets/workflow/icon_intent.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion ui/src/components/COMPONENT_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@ import WorkspaceRelationTags from '@/components/business/workspace-relation-tags
- 组件样式默认使用 `scoped`;明确的全局规则放入 `src/styles`。
- `global` 不创建仅用于二次导出的 `components/index.ts`。

### 数字输入框

项目内所有设置 `controls-position="right"` 的 `el-input-number` 必须同时显式设置
`align="left"`,统一将输入内容左对齐。页面、公共组件和工作流节点均遵循此规则。

```vue
<el-input-number v-model="value" controls-position="right" align="left" />
```

### 浮层触发节点

Element Plus 使用 `ElOnlyChild` 处理浮层触发器。`el-tooltip`、`el-popover`、
Expand Down Expand Up @@ -1069,7 +1078,6 @@ import FolderTree from '@/components/business/folder-tree/index.vue'
其他范围暂不展示创建入口。创建成功后触发 `refresh`,使用方重新加载原业务范围的模型选项,
不自动替换当前选中模型。`footer` 插槽仍可覆盖默认创建入口。


```vue
<script setup lang="ts">
import ModelSelect from '@/components/business/model-select/index.vue'
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/business/folder-tree/VirtualizedTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function handleAfterDrop() {
background: var(--mk-N900-transparent-10);
}
&:has(.mk-tree-node.is-current) {
background: rgb(var(--mk-primary-rgb) / 10%);
background: var(--mk-primary-transparent-10);
color: var(--el-color-primary);
font-weight: 500;
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/business/model-select/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function openModelParams() {
<ModelParamsDialog v-if="canEditParams" ref="modelParamsDialogRef" @submit="emit('update:modelParams', $event)" />
</template>

<style scoped>
<style scoped lang="scss">
/* 参数入口与选择器共用外边框,为原生下拉箭头和清空按钮预留空间。 */
.model-select--with-params {
:deep(.el-select__wrapper) {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/conversation/chat-panel/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ provide('sendMessage', sendMessage)
defineExpose({ scrollToBottom })
</script>

<style scoped>
<style scoped lang="scss">
.chat-panel {
flex: 1;
min-width: 0;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/conversation/content-list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const contents = computed(() => {
})
</script>

<style scoped>
<style scoped lang="scss">
.content-list {
display: flex;
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/conversation/content/items/failure.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defineProps<{
}>()
</script>

<style scoped>
<style scoped lang="scss">
.content-failure {
display: flex;
align-items: flex-start;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/conversation/content/items/form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const submit = async () => {
}
</script>

<style scoped>
<style scoped lang="scss">
.content-form {
background: #ffffff;
border: 1px solid var(--el-border-color-lighter, #e4e7ed);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/conversation/content/items/question.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const download = (file: any) => {
}
</script>

<style scoped>
<style scoped lang="scss">
.question-content {
display: flex;
justify-content: flex-end;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/conversation/content/items/reasoning.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ watch(() => props.content.status, (status) => {
})
</script>

<style scoped>
<style scoped lang="scss">
.reasoning {
width: 100%;
margin-bottom: 8px;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/conversation/content/items/text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defineProps<{
}>()
</script>

<style scoped>
<style scoped lang="scss">
.content-text :deep(.md-editor) {
background: transparent;
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/conversation/content/items/tool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ defineProps<{
}>()
</script>

<style scoped>
<style scoped lang="scss">
.content-tool {
background: var(--bg2, #fafafa);
border: 1px solid var(--bd, #dcdfe6);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/conversation/editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ onMounted(() => {
defineExpose({ clear, focus })
</script>

<style scoped>
<style scoped lang="scss">
.md-editor {
flex: 1;
min-width: 0;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/conversation/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ onBeforeUnmount(() => {
})
</script>

<style scoped>
<style scoped lang="scss">
.conversation-plus {
display: flex;
height: 100%;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/conversation/loading/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ withDefaults(
)
</script>

<style scoped>
<style scoped lang="scss">
.loading-dots {
display: flex;
align-items: center;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/conversation/sidebar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const confirmRename = () => {
}
</script>

<style scoped>
<style scoped lang="scss">
.sidebar {
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ function submitEditorDialog() {
</MkDialog>
</template>

<style scoped></style>
<style scoped lang="scss"></style>
7 changes: 1 addition & 6 deletions ui/src/components/global/markdown-editor/MdPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,4 @@ const language = computed(() => {
<MdPreviewV3 class="mk-markdown-editor" :language="language" :code-foldable="false" v-bind="$attrs" />
</template>

<style scoped>
:deep(audio) {
width: 300px;
height: 43px;
}
</style>
<style scoped lang="scss"></style>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ watch(
const getData = () => {
return {
input_type: 'PasswordInput',
attrs: { maxlength: formValue.value.maxlength, minlength: formValue.value.minlength, 'show-word-limit': true, type: 'password', 'show-password': true },
attrs: {
maxlength: formValue.value.maxlength,
minlength: formValue.value.minlength,
'show-word-limit': true,
type: 'password',
'show-password': true,
},
default_value: formValue.value.default_value,
show_default_value: formValue.value.show_default_value,
props_info: {
Expand Down Expand Up @@ -57,7 +63,12 @@ const render = (formData: DynamicFormValue) => {
formValue.value.show_password = attrs['show-password']
}
const rules = computed(() => [
{ min: formValue.value.minlength, max: formValue.value.maxlength, message: `长度在 ${formValue.value.minlength} 到 ${formValue.value.maxlength} 个字符`, trigger: 'blur' },
{
min: formValue.value.minlength,
max: formValue.value.maxlength,
message: `长度在 ${formValue.value.minlength} 到 ${formValue.value.maxlength} 个字符`,
trigger: 'blur',
},
])

defineExpose({ getData, render })
Expand All @@ -77,7 +88,7 @@ onMounted(() => {
<el-form-item label="文本长度" required>
<div class="flex w-full items-start gap-2">
<el-form-item class="min-w-0 flex-1" :rules="[{ required: true, message: '请输入最小长度', trigger: 'change' }]" prop="minlength">
<el-input-number v-model="formValue.minlength" class="w-full!" :min="1" :step="1" controls-position="right" step-strictly />
<el-input-number v-model="formValue.minlength" class="w-full!" :min="1" :step="1" controls-position="right" align="left" step-strictly />
</el-form-item>
<span class="flex-center shrink-0">-</span>
<el-form-item class="min-w-0 flex-1" :rules="[{ required: true, message: '请输入最大长度', trigger: 'change' }]" prop="maxlength">
Expand All @@ -87,6 +98,7 @@ onMounted(() => {
:min="formValue.minlength > formValue.maxlength ? formValue.minlength : 1"
:step="1"
controls-position="right"
align="left"
step-strictly
/>
</el-form-item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,36 @@ onBeforeMount(() => {
<el-form-item label="取值范围" required>
<el-col :span="11" style="padding-left: 0">
<el-form-item :rules="[{ required: true, message: '最小值必填', trigger: 'change' }]" prop="min">
<el-input-number style="width: 100%" v-model="formValue.min" controls-position="right"
<el-input-number style="width: 100%" v-model="formValue.min" controls-position="right" align="left"
/></el-form-item>
</el-col>
<el-col :span="2" class="text-center">
<span class="text-gray-500">-</span>
</el-col>
<el-col :span="11">
<el-form-item :rules="[{ required: true, message: '最大值必填', trigger: 'change' }]" prop="max"
><el-input-number prop="max" style="width: 100%" v-model="formValue.max" :min="formValue.min > formValue.max ? formValue.min : undefined" controls-position="right"
><el-input-number
prop="max"
style="width: 100%"
v-model="formValue.max"
:min="formValue.min > formValue.max ? formValue.min : undefined"
controls-position="right"
align="left"
/></el-form-item>
</el-col>
</el-form-item>
<el-col :span="11" style="padding-left: 0">
<el-form-item label="步长值" required prop="step" :rules="stepRules">
<el-input-number style="width: 100%" v-model="formValue.step" :min="0" controls-position="right" />
<el-input-number style="width: 100%" v-model="formValue.step" :min="0" controls-position="right" align="left" />
</el-form-item>
</el-col>

<el-form-item label="默认值" :required="formValue.required" prop="default_value" :rules="formValue.required ? [{ required: true, message: '为必填属性' }] : []">
<el-form-item
label="默认值"
:required="formValue.required"
prop="default_value"
:rules="formValue.required ? [{ required: true, message: '为必填属性' }] : []"
>
<el-slider
v-model="formValue.default_value"
:show-input="formValue.showInput"
Expand Down
Loading
Loading