Skip to content
Merged

Home #5299

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
114 changes: 114 additions & 0 deletions ui/src/api/home-page/home.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import { Result } from '@/request/Result'
import { get, post, del, put, exportFile } from '@/request/index'
import { type Ref } from 'vue'
import type { pageRequest } from '@/api/type/common'

import useStore from '@/stores'
const prefix: any = { _value: '/workspace/' }
Object.defineProperty(prefix, 'value', {
get: function () {
const { user } = useStore()
return this._value + user.getWorkspaceId() + '/homepage'
},
})

/**
* 应用聚合
* @params
*/
const getApplicationAggregation: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => {
return get(`${prefix.value}/application/aggregation`, undefined, loading)
}
/**
* 知识库聚合
* @params
*/
const getKnowledgeAggregation: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => {
return get(`${prefix.value}/knowledge/aggregation`, undefined, loading)
}
/**
* 工具聚合
* @params
*/
const getToolAggregation: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => {
return get(`${prefix.value}/tool/aggregation`, undefined, loading)
}
/**
* 模型聚合
* @params
*/
const getModelAggregation: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => {
return get(`${prefix.value}/model/aggregation`, undefined, loading)
}

/**
* Tokens 消耗
* @params {end_time,start_time}
*/
const getTokensRanking: (
page: pageRequest,
params: any,
loading?: Ref<boolean>,
) => Promise<Result<any>> = (page, params, loading) => {
return get(
`${prefix.value}/application/tokens_ranking/${page.current_page}/${page.page_size}`,
params,
loading,
)
}
/**
* 提问次数
* @params {end_time,start_time}
*/
const getQuestionsRanking: (
page: pageRequest,
params: any,
loading?: Ref<boolean>,
) => Promise<Result<any>> = (page, params, loading) => {
return get(
`${prefix.value}/application/question_ranking/${page.current_page}/${page.page_size}`,
params,
loading,
)
}
/**
* 用户消耗token
* @params {end_time,start_time}
*/
const getUserTokensRanking: (
page: pageRequest,
params: any,
loading?: Ref<boolean>,
) => Promise<Result<any>> = (page, params, loading) => {
return get(
`${prefix.value}/application/user_tokens_ranking/${page.current_page}/${page.page_size}`,
params,
loading,
)
}

/**
* 与对话有关的统计趋势
* @params {application_id, end_time, start_time}
*/
const getMonitorAggregation: (params: any, loading?: Ref<boolean>) => Promise<Result<any>> = (
params,
loading,
) => {
return get(
`${prefix.value}/monitoring/aggregation`,
params,
loading,
)
}

export default {
getApplicationAggregation,
getKnowledgeAggregation,
getToolAggregation,
getModelAggregation,
getTokensRanking,
getQuestionsRanking,
getUserTokensRanking,
getMonitorAggregation,
}
8 changes: 8 additions & 0 deletions ui/src/assets/home/icon_create-agent.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions ui/src/assets/home/icon_create-knowledge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions ui/src/assets/home/icon_create-model.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions ui/src/assets/home/icon_create-tool.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ const isSubmitDisabled = computed(() => {
const LIKE_REASONS = [
{ label: t('chat.vote.accurate'), value: 'accurate' },
{ label: t('chat.vote.complete'), value: 'complete' },
{ label: t('chat.vote.other'), value: 'other' },
{ label: t('common.other'), value: 'other' },
]

const OPPOSE_REASONS = [
{ label: t('chat.vote.inaccurate'), value: 'inaccurate' },
{ label: t('chat.vote.irrelevantAnswer'), value: 'incomplete' },
{ label: t('chat.vote.other'), value: 'other' },
{ label: t('common.other'), value: 'other' },
]

const title = computed(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ const isSubmitDisabled = computed(() => {
const LIKE_REASONS = [
{ label: t('chat.vote.accurate'), value: 'accurate' },
{ label: t('chat.vote.complete'), value: 'complete' },
{ label: t('chat.vote.other'), value: 'other' },
{ label: t('common.other'), value: 'other' },
]

const OPPOSE_REASONS = [
{ label: t('chat.vote.inaccurate'), value: 'inaccurate' },
{ label: t('chat.vote.irrelevantAnswer'), value: 'incomplete' },
{ label: t('chat.vote.other'), value: 'other' },
{ label: t('common.other'), value: 'other' },
]

const title = computed(() => {
Expand Down
41 changes: 40 additions & 1 deletion ui/src/components/app-icon/icons/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,46 @@ export default {
d: 'M0.666748 6.07278C0.666748 5.71259 1.0361 5.47056 1.36635 5.61435L6.95893 8.04931C7.14136 8.12874 7.25933 8.30877 7.25933 8.50774V14.5055C7.25933 14.8817 6.85964 15.1231 6.5267 14.9481L0.915073 11.9985C0.840862 11.9578 0.778897 11.8989 0.735342 11.8276C0.691787 11.7564 0.668161 11.6753 0.666813 11.5924L0.666748 11.585V6.07278ZM14.6312 5.60774C14.9618 5.46158 15.3334 5.70361 15.3334 6.06503V11.585C15.3334 11.6691 15.3104 11.7518 15.2668 11.8244C15.2231 11.8971 15.1604 11.9571 15.0851 11.9985L9.47345 14.9481C9.14051 15.1231 8.74081 14.8817 8.74082 14.5055L8.74083 8.53793C8.74083 8.33999 8.8576 8.16069 9.03863 8.08064L14.6312 5.60774ZM7.76 1.39457C7.83327 1.35437 7.91597 1.33325 8.00008 1.33325C8.0842 1.33325 8.16689 1.35437 8.24016 1.39457L13.55 3.75304C13.9482 3.92991 13.9454 4.49602 13.5455 4.66894L8.19851 6.98075C8.07189 7.0355 7.92827 7.0355 7.80165 6.98075L2.45469 4.66894C2.05476 4.49602 2.05196 3.92991 2.45016 3.75304L7.76 1.39457Z',
fill: 'currentColor',
}),

],
),
])
},
},
'app-home': {
iconReader: () => {
return h('i', [
h(
'svg',
{
viewBox: '0 0 1024 1024',
version: '1.1',
xmlns: 'http://www.w3.org/2000/svg',
},
[
h('path', {
d: 'M487.381333 114.474667a42.666667 42.666667 0 0 1 49.237334 0l362.666666 256a42.666667 42.666667 0 0 1 18.048 34.858666v469.333334a42.666667 42.666667 0 0 1-42.666666 42.666666H554.666667v-256a42.666667 42.666667 0 1 0-85.333334 0v256H149.333333a42.666667 42.666667 0 0 1-42.666666-42.666666v-469.333334a42.666667 42.666667 0 0 1 18.048-34.858666l362.666666-256zM640 832h192v-404.565333L512 201.557333l-320 225.877334V832H384v-170.666667a128 128 0 1 1 256 0v170.666667z',
fill: 'currentColor',
}),
],
),
])
},
},
'app-home-active': {
iconReader: () => {
return h('i', [
h(
'svg',
{
viewBox: '0 0 1024 1024',
version: '1.1',
xmlns: 'http://www.w3.org/2000/svg',
},
[
h('path', {
d: 'M487.381333 114.474667a42.666667 42.666667 0 0 1 49.237334 0l362.666666 256a42.666667 42.666667 0 0 1 18.048 34.858666v469.333334a42.666667 42.666667 0 0 1-42.666666 42.666666H597.333333v-213.333333a85.333333 85.333333 0 1 0-170.666666 0v213.333333H149.333333a42.666667 42.666667 0 0 1-42.666666-42.666666v-469.333334a42.666667 42.666667 0 0 1 18.048-34.858666l362.666666-256z',
fill: 'currentColor',
}),
],
),
])
Expand Down
2 changes: 1 addition & 1 deletion ui/src/layout/layout-header/top-menu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { hasPermission, set_next_route } from '@/utils/permission/index'
import MenuItem from './MenuItem.vue'

const topMenuList = computed(() => {
const menu = getChildRouteListByPathAndName('/', 'home').filter(
const menu = getChildRouteListByPathAndName('/', 'root').filter(
(item) =>
item.meta?.menu &&
(item.meta.permission ? hasPermission(item.meta.permission as any, 'OR') : true),
Expand Down
1 change: 0 additions & 1 deletion ui/src/locales/lang/en-US/ai-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export default {
inaccurate: 'Answer is inaccurate',
complete: 'Content is complete',
irrelevantAnswer: 'Answer is irrelevant',
other: 'Other',
placeholder: 'Tell us more about your relevant experiences',
},
tip: {
Expand Down
4 changes: 3 additions & 1 deletion ui/src/locales/lang/en-US/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ export default {
subTitle: 'View Execution Record',
},
sourceType: 'Source type',
knowledgeImportTip: 'Knowledge base imported successfully. Documents have not been vectorized yet. Please configure the embedding model and vectorize the documents.',
knowledgeImportTip:
'Knowledge base imported successfully. Documents have not been vectorized yet. Please configure the embedding model and vectorize the documents.',
import: 'Import',
other: 'Other',
}
28 changes: 28 additions & 0 deletions ui/src/locales/lang/en-US/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,34 @@ export default {
language: 'Language',
isExpire: 'License not uploaded or expired',
crossSettings: 'Cross-Origin Settings',
home: {
title: 'Home',
rankingList: 'Ranking List',
rank: 'Rank',
rankDetail: 'Ranking Detail',
consume: 'Consumption',
quickCreate: 'Quick Create',
createAgent: 'Create Agent',
createAgentDescribe: 'From template or blank',
createKnowledge: 'Create Knowledge Base',
createKnowledgeDescribe: 'Upload documents or websites',
createTool: 'Add Tool',
createToolDescribe: 'Script tools or workflow tools',
createModel: 'Add Model',
createModelDescribe: 'Configure large language/vector models',
resource: 'Resources',
llm: 'Large Language Model',
embedding: 'Embedding',
chat: 'Chat',
average‌: 'Average',
activeUsers: 'Active Users',
wheel: 'Wheel',
person: 'Person',
questions: 'Questions',
proportion: 'Proportion',
perDialogueRounds: 'Average Dialogue Rounds',
commonlyAgents: 'Commonly Used Agents',
},
about: {
title: 'About',
expiredTime: 'Expiration Date',
Expand Down
7 changes: 5 additions & 2 deletions ui/src/locales/lang/en-US/views/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,20 @@ export default {
setting: 'Long-term Memory Settings',
triggerType: 'Trigger Type',
roundTrigger: 'Round-based Trigger',
roundTriggerTip: 'After accumulating N rounds, automatically extract N rounds of conversation to generate memory',
roundTriggerTip:
'After accumulating N rounds, automatically extract N rounds of conversation to generate memory',
triggerInterval: 'Trigger Interval',
scheduledTrigger: 'Scheduled Trigger',
scheduledTriggerTip: 'After reaching the set time, automatically extract all conversations within the cycle to generate memory',
scheduledTriggerTip:
'After reaching the set time, automatically extract all conversations within the cycle to generate memory',
cronExpressionInvalid: 'Cron expression is invalid',
tips1: `After enabling, new conversations will be recorded from the activation time and memory will be generated periodically, which can be called through`,
tips2: `variables in the system prompt.
After disabling, the long-term memory of the conversation users will be cleared, and re-enabling will resume accumulation from the activation point.`,
},
form: {
appName: {
label: 'Agent name',
placeholder: 'Please enter the agent name',
requiredMessage: 'Agent name is required',
},
Expand Down
1 change: 0 additions & 1 deletion ui/src/locales/lang/en-US/views/chat-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default {
},
table: {
abstract: 'Title',
username: 'User',
chat_record_count: 'Total Messages',
user: 'User',
feedback: {
Expand Down
2 changes: 0 additions & 2 deletions ui/src/locales/lang/en-US/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export default {
classify: {
aiCapability: 'AI capability',
businessLogic: 'Business logic',
other: 'Other',
dataProcessing: 'Data Processing',
},
startNode: {
Expand Down Expand Up @@ -451,7 +450,6 @@ You are a master of problem optimization, adept at accurately inferring user int
intentNode: {
label: 'IntentNode',
text: 'Match user questions with user-defined intent classifications',
other: 'other',
error2: 'Repeated intent',
placeholder: 'Please choose a classification option',
classify: {
Expand Down
1 change: 0 additions & 1 deletion ui/src/locales/lang/zh-CN/ai-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export default {
inaccurate: '回答不准确',
complete: '内容完善',
irrelevantAnswer: '回答不相关',
other: '其他',
placeholder: '告诉我们更多关于你的相关体验',
},
tip: {
Expand Down
1 change: 1 addition & 0 deletions ui/src/locales/lang/zh-CN/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,5 @@ export default {
knowledgeImportTip:
'导入创建知识库成功,文档数据未向量化,请先设置知识库的向量模型,并对文档进行向量化操作',
import: '导入',
other: '其他',
}
28 changes: 28 additions & 0 deletions ui/src/locales/lang/zh-CN/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,34 @@ export default {
language: '语言',
isExpire: '未上传 License 或 License 已过期。',
crossSettings: '跨域设置',
home: {
title: '首页',
rankingList: '排行榜',
rank: '排名',
rankDetail: '排行榜详情',
consume: '消耗',
quickCreate: '快速创建',
createAgent: '创建智能体',
createAgentDescribe: '从模板或空白创建',
createKnowledge: '创建知识库',
createKnowledgeDescribe: '上传文档或 Web 站点',
createTool: '添加工具',
createToolDescribe: '脚本工具或工作流工具',
createModel: '添加模型',
createModelDescribe: '配置大语言/向量等模型',
resource: '资源',
llm: '大语言',
embedding: '向量',
chat: '对话',
average‌: '均',
activeUsers: '活跃用户',
wheel: '轮',
person: '人',
questions: '提问',
proportion: '占比',
perDialogueRounds: '人均对话轮次',
commonlyAgents: '常用智能体',
},
about: {
title: '关于',
expiredTime: '到期时间',
Expand Down
1 change: 1 addition & 0 deletions ui/src/locales/lang/zh-CN/views/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default {
},
form: {
appName: {
label: '智能体名称',
placeholder: '请输入智能体名称',
requiredMessage: '请输入智能体名称',
},
Expand Down
1 change: 0 additions & 1 deletion ui/src/locales/lang/zh-CN/views/chat-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default {
},
table: {
abstract: '摘要',
username: '用户',
chat_record_count: '对话提问数',
user: '用户',
feedback: {
Expand Down
Loading
Loading