feat: 对话框
This commit is contained in:
parent
9240949900
commit
d8c2dfd983
@ -133,6 +133,29 @@ const getApplicationDataset: (
|
|||||||
) => Promise<Result<any>> = (applicaiton_id, loading) => {
|
) => Promise<Result<any>> = (applicaiton_id, loading) => {
|
||||||
return get(`${prefix}/${applicaiton_id}/list_dataset`, undefined, loading)
|
return get(`${prefix}/${applicaiton_id}/list_dataset`, undefined, loading)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API_KEY列表
|
||||||
|
* @param 参数 applicaiton_id
|
||||||
|
*/
|
||||||
|
const getAPIKey: (applicaiton_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = (
|
||||||
|
applicaiton_id,
|
||||||
|
loading
|
||||||
|
) => {
|
||||||
|
return get(`${prefix}/${applicaiton_id}/api_key`, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取AccessToken
|
||||||
|
* @param 参数 applicaiton_id
|
||||||
|
*/
|
||||||
|
const getAccessToken: (applicaiton_id: string, loading?: Ref<boolean>) => Promise<Result<any>> = (
|
||||||
|
applicaiton_id,
|
||||||
|
loading
|
||||||
|
) => {
|
||||||
|
return get(`${prefix}/${applicaiton_id}/access-token`, undefined, loading)
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getAllAppilcation,
|
getAllAppilcation,
|
||||||
getApplication,
|
getApplication,
|
||||||
@ -142,5 +165,7 @@ export default {
|
|||||||
postChatMessage,
|
postChatMessage,
|
||||||
delApplication,
|
delApplication,
|
||||||
getApplicationDetail,
|
getApplicationDetail,
|
||||||
getApplicationDataset
|
getApplicationDataset,
|
||||||
|
getAPIKey,
|
||||||
|
getAccessToken
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,12 @@ export const routes: Array<RouteRecordRaw> = [
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
path: '/chat/:accessToken',
|
||||||
|
name: 'Chat',
|
||||||
|
component: () => import('@/views/chat/index.vue')
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
name: 'login',
|
name: 'login',
|
||||||
|
|||||||
@ -4,7 +4,9 @@ import { type Ref } from 'vue'
|
|||||||
|
|
||||||
const useApplicationStore = defineStore({
|
const useApplicationStore = defineStore({
|
||||||
id: 'application',
|
id: 'application',
|
||||||
state: () => ({}),
|
state: () => ({
|
||||||
|
location: `${window.location.origin}/ui/chat/`
|
||||||
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
async asyncGetAllApplication() {
|
async asyncGetAllApplication() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -30,6 +32,19 @@ const useApplicationStore = defineStore({
|
|||||||
reject(error)
|
reject(error)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
async asyncGetAccessToken(id: string, loading?: Ref<boolean>) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
applicationApi
|
||||||
|
.getAccessToken(id, loading)
|
||||||
|
.then((data) => {
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -132,6 +132,9 @@ h4 {
|
|||||||
.ml-16 {
|
.ml-16 {
|
||||||
margin-left: calc(var(--app-base-px) * 2);
|
margin-left: calc(var(--app-base-px) * 2);
|
||||||
}
|
}
|
||||||
|
.ml-24 {
|
||||||
|
margin-left: calc(var(--app-base-px) * 3);
|
||||||
|
}
|
||||||
.mr-4 {
|
.mr-4 {
|
||||||
margin-right: calc(var(--app-base-px) - 4px);
|
margin-right: calc(var(--app-base-px) - 4px);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,10 +7,10 @@
|
|||||||
<AppAvatar class="mr-12" shape="square" :size="32">
|
<AppAvatar class="mr-12" shape="square" :size="32">
|
||||||
<img src="@/assets/icon_document.svg" style="width: 58%" alt="" />
|
<img src="@/assets/icon_document.svg" style="width: 58%" alt="" />
|
||||||
</AppAvatar>
|
</AppAvatar>
|
||||||
<h4 class="ellipsis-1">应用</h4>
|
<h4 class="ellipsis-1">{{ detail?.name }}</h4>
|
||||||
<div class="ml-8">
|
<div class="ml-8" v-if="detail">
|
||||||
<el-tag class="warning-tag">已停用</el-tag>
|
<el-tag v-if="detail?.status" class="success-tag">运行中</el-tag>
|
||||||
<el-tag class="success-tag">运行中</el-tag>
|
<el-tag v-else class="warning-tag">已停用</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="active-button" @click.stop>
|
<div class="active-button" @click.stop>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
<el-text type="info">公开访问链接</el-text>
|
<el-text type="info">公开访问链接</el-text>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<span class="vertical-middle lighter">
|
<span class="vertical-middle lighter">
|
||||||
https:/fit2cloud.com/xlab-fit2cloud/smart-doc/16826
|
{{ shareUrl }}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<el-button type="primary" text>
|
<el-button type="primary" text>
|
||||||
@ -63,7 +63,47 @@
|
|||||||
</div>
|
</div>
|
||||||
</LayoutContainer>
|
</LayoutContainer>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts"></script>
|
<script setup lang="ts">
|
||||||
|
import { reactive, ref, watch, onMounted } from 'vue'
|
||||||
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
|
import applicationApi from '@/api/application'
|
||||||
|
import useStore from '@/stores'
|
||||||
|
const { application } = useStore()
|
||||||
|
const router = useRouter()
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
const shareUrl = ref('')
|
||||||
|
const detail = ref<any>(null)
|
||||||
|
const apiKey = ref<any>(null)
|
||||||
|
const {
|
||||||
|
params: { id }
|
||||||
|
} = route as any
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
|
||||||
|
function getAccessToken() {
|
||||||
|
application.asyncGetAccessToken(id, loading).then((res) => {
|
||||||
|
shareUrl.value = application.location + res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function getApiKey() {
|
||||||
|
applicationApi.getAPIKey(id, loading).then((res) => {
|
||||||
|
apiKey.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDetail() {
|
||||||
|
application.asyncGetApplicationDetail(id, loading).then((res: any) => {
|
||||||
|
detail.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
getDetail()
|
||||||
|
getApiKey()
|
||||||
|
getAccessToken()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.overview-card {
|
.overview-card {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
36
ui/src/views/chat/index.vue
Normal file
36
ui/src/views/chat/index.vue
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<template>
|
||||||
|
<div class="chat">
|
||||||
|
<div class="chat__header">
|
||||||
|
<div class="chat-width"><h2 class="ml-24">111</h2></div>
|
||||||
|
</div>
|
||||||
|
<div class="chat__main chat-width"><AiDialog></AiDialog></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import AiDialog from '@/components/ai-dialog/index.vue'
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.chat {
|
||||||
|
background-color: var(--app-layout-bg-color);
|
||||||
|
&__header {
|
||||||
|
background: var(--app-header-bg-color);
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
z-index: 100;
|
||||||
|
height: var(--app-header-height);
|
||||||
|
line-height: var(--app-header-height);
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: var(--app-header-padding);
|
||||||
|
}
|
||||||
|
&__main {
|
||||||
|
padding-top: calc(var(--app-header-height) + 24px);
|
||||||
|
height: calc(100vh - var(--app-header-height) - 24px);
|
||||||
|
}
|
||||||
|
.chat-width {
|
||||||
|
width: 840px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user