Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
Equim-chan committed Mar 31, 2023
1 parent c633098 commit ebf7139
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
38 changes: 18 additions & 20 deletions src/views/chat/components/Message/Text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,25 @@ defineExpose({ inputRef })
<template>
<div :class="wrapClass">
<div class="leading-relaxed break-words">
<template v-if="edit">
<div class="whitespace-pre-wrap">
<NInput
ref="inputRef"
:value="text"
type="textarea"
:autosize="{ minRows: 5 }"
@input="handleInput"
@keypress="handleKeypress"
@keydown="handleKeydown"
/>
<div class="chat-edit-buttons">
<NButton type="primary" @click="handleSubmit">
{{ t('chat.saveAndSubmit') }}
</NButton>
<NButton @click="handleCancel">
{{ t('chat.cancel') }}
</NButton>
</div>
<div v-if="edit" class="whitespace-pre-wrap">
<NInput
ref="inputRef"
:value="text"
type="textarea"
:autosize="{ minRows: 5 }"
@input="handleInput"
@keypress="handleKeypress"
@keydown="handleKeydown"
/>
<div class="chat-edit-buttons">
<NButton type="primary" @click="handleSubmit">
{{ t('chat.saveAndSubmit') }}
</NButton>
<NButton @click="handleCancel">
{{ t('chat.cancel') }}
</NButton>
</div>
</template>
</div>
<div v-else class="flex items-end">
<div v-if="!asRawText && !edit" class="markdown-body" v-html="text" />
<div v-else class="whitespace-pre-wrap" v-text="text" />
Expand Down
1 change: 0 additions & 1 deletion src/views/chat/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ async function onEdit(text: string, index: number) {
requestOptions: { prompt: message, options: { ...options } },
},
)
scrollToBottomIfAtBottom()
}
finally {
loading.value = false
Expand Down

0 comments on commit ebf7139

Please sign in to comment.