update dialog
This commit is contained in:
1 parent
f03b70d89c
commit
3e5e158b27
6 files changed
+269
-51
No files matched your search
@@ -1,17 +1,20 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<model-selector v-model="model" class="model-selector" @select="onSelectModel" />
|
||||
<api-status :application="application" />
|
||||
<sidebar class="left" :application="application" @click="onFetchHistory" />
|
||||
<div class="main">
|
||||
<introduction v-if="messages && messages.length === 0" />
|
||||
<div v-else class="messages">
|
||||
<div v-for="(message, messageIndex) in messages" :key="messageIndex">
|
||||
<message :message="message" class="message" />
|
||||
<model-selector v-model="model" class="model-selector" @select="onSelectModel" />
|
||||
<api-status :application="application" />
|
||||
<div class="dialogue">
|
||||
<introduction v-if="messages && messages.length === 0" />
|
||||
<div v-else class="messages">
|
||||
<div v-for="(message, messageIndex) in messages" :key="messageIndex">
|
||||
<message :message="message" class="message" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<input-box v-model="question" @submit="onSubmitQuestion" />
|
||||
<div class="bottom">
|
||||
<input-box v-model="question" @submit="onSubmitQuestion" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -38,6 +41,7 @@ import { ERROR_CODE_CANCELED, ERROR_CODE_UNKNOWN } from '@/constants/errorCode';
|
||||
import axios from 'axios';
|
||||
import ApiStatus from '@/components/common/ApiStatus.vue';
|
||||
import { ROUTE_CHAT_CONVERSATION, ROUTE_CHAT_CONVERSATION_NEW } from '@/router';
|
||||
import Sidebar from '@/components/chat/Sidebar.vue';
|
||||
|
||||
export interface IData {
|
||||
messages: IChatMessage[];
|
||||
@@ -55,7 +59,8 @@ export default defineComponent({
|
||||
InputBox,
|
||||
ModelSelector,
|
||||
Message,
|
||||
ApiStatus
|
||||
ApiStatus,
|
||||
Sidebar
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
@@ -110,10 +115,7 @@ export default defineComponent({
|
||||
this.question = '';
|
||||
await this.onFetchAnswer();
|
||||
},
|
||||
async onFetchHistory() {
|
||||
if (!this.conversationId) {
|
||||
return;
|
||||
}
|
||||
async onFetchHistory(id?: string) {
|
||||
const endpoint = this.application?.api?.endpoint;
|
||||
const path = this.application?.api?.path;
|
||||
console.log(endpoint, path);
|
||||
@@ -124,7 +126,7 @@ export default defineComponent({
|
||||
const { data: data } = await chatOperator.conversations(
|
||||
{
|
||||
action: IChatConversationAction.RETRIEVE,
|
||||
id: this.conversationId
|
||||
id: id || this.conversationId
|
||||
},
|
||||
{
|
||||
endpoint,
|
||||
@@ -208,20 +210,40 @@ export default defineComponent({
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.left {
|
||||
display: block;
|
||||
width: 300px;
|
||||
height: 100%;
|
||||
border-right: 1px solid #eee;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.main {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
overflow-y: scroll;
|
||||
padding: 15px;
|
||||
.messages {
|
||||
.message {
|
||||
margin-bottom: 15px;
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
display: flex;
|
||||
|
||||
.model-selector {
|
||||
width: max-content;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.dialogue {
|
||||
flex: 1;
|
||||
.messages {
|
||||
.message {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
<template>
|
||||
<div class="page"></div>
|
||||
<div class="page">
|
||||
<sidebar class="left" :application="application" />
|
||||
<div class="main">
|
||||
<div class="card">
|
||||
<h2 class="title">Chat</h2>
|
||||
<p class="description">Click to start a new chat</p>
|
||||
<el-button type="primary" @click="onStart">New</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -10,15 +19,30 @@ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import Introduction from '@/components/conversation/Introduction.vue';
|
||||
import InputBox from '@/components/chat/InputBox.vue';
|
||||
import ModelSelector from '@/components/chat/ModelSelector.vue';
|
||||
import Sidebar from '@/components/chat/Sidebar.vue';
|
||||
import { ROUTE_CHAT_CONVERSATION_NEW } from '@/router/constants';
|
||||
import application from '@/i18n/zh/application';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ChatIndex',
|
||||
components: {},
|
||||
components: {
|
||||
Sidebar,
|
||||
ElButton
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
model: 'chatgpt',
|
||||
drawer: false,
|
||||
question: ''
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onStart() {
|
||||
console.log('onStart');
|
||||
this.$router.push({
|
||||
name: ROUTE_CHAT_CONVERSATION_NEW
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -30,14 +54,34 @@ export default defineComponent({
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
.left {
|
||||
display: none;
|
||||
display: block;
|
||||
width: 300px;
|
||||
height: 100%;
|
||||
border-right: 1px solid #eee;
|
||||
}
|
||||
.main {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
.card {
|
||||
width: 200px;
|
||||
height: 150px;
|
||||
text-align: center;
|
||||
|
||||
.title {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.description {
|
||||
font-size: 14px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -9,9 +9,7 @@
|
||||
<prompt-input v-model="prompt" class="mb-4" />
|
||||
<elements-selector v-model="elements" class="mb-4" />
|
||||
<ignore-selector v-if="preset.advanced" v-model="ignore" class="mb-4" />
|
||||
<p>
|
||||
{{ finalPrompt }}
|
||||
</p>
|
||||
<final-prompt :model-value="finalPrompt" />
|
||||
<el-button type="primary" @click="onGenerate"> 生成 </el-button>
|
||||
</div>
|
||||
<div class="tasks">
|
||||
@@ -43,6 +41,7 @@ import {
|
||||
} from '@/operators';
|
||||
import ApiStatus from '@/components/common/ApiStatus.vue';
|
||||
import TaskBriefList from '@/components/midjourney/TaskBriefList.vue';
|
||||
import FinalPrompt from '@/components/midjourney/FinalPrompt.vue';
|
||||
|
||||
interface IData {
|
||||
channel: IMidjourneyChannel;
|
||||
@@ -66,7 +65,8 @@ export default defineComponent({
|
||||
IgnoreSelector,
|
||||
ElButton,
|
||||
ApiStatus,
|
||||
TaskBriefList
|
||||
TaskBriefList,
|
||||
FinalPrompt
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user