diff --git a/src/components/chat/InputBox.vue b/src/components/chat/InputBox.vue
index 1a499c0..9dba783 100644
--- a/src/components/chat/InputBox.vue
+++ b/src/components/chat/InputBox.vue
@@ -2,7 +2,11 @@
[]
+ },
+ question: {
type: String,
required: true
}
},
- emits: ['update:modelValue', 'submit'],
+ emits: ['update:question', 'update:references', 'submit'],
data() {
return {
- value: this.modelValue,
+ questionValue: this.question,
fileList: []
};
},
@@ -73,27 +83,34 @@ export default defineComponent({
Authorization: `Bearer ${this.$store.state.token.access}`
};
},
- urls() {
+ urls(): string[] {
// @ts-ignore
return this.fileList.map((file: UploadFile) => file?.response?.file_url);
+ },
+ canUpload() {
+ return [CHAT_MODEL_CHATGPT4_VISION.name].includes(this.model.name);
+ },
+ model(): IChatModel {
+ return this.$store.state.chat.model;
}
},
watch: {
- value(val) {
- this.$emit('update:modelValue', val);
+ urls(val) {
+ this.$emit('update:references', val);
},
- modelValue(val) {
- if (val !== this.value) {
- this.value = val;
- }
+ questionValue(val: string) {
+ this.$emit('update:question', val);
}
+ // question(val: string) {
+ // this.questionValue = val;
+ // }
},
methods: {
onSubmit() {
- if (!this.value) {
+ if (!this.question) {
return;
}
- this.$emit('submit', this.value);
+ this.$emit('submit');
},
onExceed() {
ElMessage.warning(this.$t('chat.message.uploadReferencesExceed'));
@@ -118,7 +135,7 @@ export default defineComponent({
}
.el-upload-list {
position: absolute;
- width: 200px;
+ width: 400px;
bottom: 40px;
}
}
@@ -135,6 +152,14 @@ export default defineComponent({
top: 40px;
.upload {
display: inline-block;
+ &.disabled {
+ .btn-upload {
+ cursor: not-allowed;
+ .icon-attachment {
+ color: #eee;
+ }
+ }
+ }
}
.input {
border: none;
diff --git a/src/operators/chat/models.ts b/src/operators/chat/models.ts
index 9177cc9..d8e85ab 100644
--- a/src/operators/chat/models.ts
+++ b/src/operators/chat/models.ts
@@ -66,6 +66,7 @@ export interface IChatConversationOptions {
export interface IChatAskRequest {
question: string;
+ references?: string[];
stateful?: boolean;
conversation_id?: string;
}
diff --git a/src/pages/chat/Conversation.vue b/src/pages/chat/Conversation.vue
index d9a5639..7ade15e 100644
--- a/src/pages/chat/Conversation.vue
+++ b/src/pages/chat/Conversation.vue
@@ -14,7 +14,13 @@
-
+
@@ -43,7 +49,8 @@ import { Status } from '@/store/common/models';
import { log } from '@/utils/log';
export interface IData {
- question: '';
+ question: string;
+ references: string[];
messages: IChatMessage[];
}
@@ -58,6 +65,7 @@ export default defineComponent({
data(): IData {
return {
question: '',
+ references: [],
messages:
this.$store.state.chat.conversations?.find(
(conversation: IChatConversation) => conversation.id === this.$route.params.id?.toString()
@@ -153,6 +161,7 @@ export default defineComponent({
.askQuestion(
{
question,
+ references: this.references,
conversation_id: this.conversationId,
stateful: true
},