-
Notifications
You must be signed in to change notification settings - Fork 2.1k
perf: refine user input style #2680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
<template> | ||
<div ref="aiChatRef" class="ai-chat" :class="type"> | ||
<div | ||
ref="aiChatRef" | ||
class="ai-chat" | ||
:class="type" | ||
:style="{ height: firsUserInput ? '100%' : undefined }" | ||
> | ||
<div | ||
v-show="showUserInputContent" | ||
:class="firsUserInput ? 'firstUserInput' : 'popperUserInput'" | ||
|
@@ -521,7 +526,15 @@ defineExpose({ | |
height: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
overflow: auto; | ||
.user-form-container { | ||
max-width: 70%; | ||
} | ||
} | ||
.debug-ai-chat { | ||
.user-form-container { | ||
max-width: 100%; | ||
} | ||
} | ||
.popperUserInput { | ||
position: absolute; | ||
|
@@ -531,4 +544,11 @@ defineExpose({ | |
width: calc(100% - 50px); | ||
max-width: 400px; | ||
} | ||
@media only screen and (max-width: 768px) { | ||
.firstUserInput { | ||
.user-form-container { | ||
max-width: 100%; | ||
} | ||
} | ||
} | ||
</style> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided TypeScript Vue component for an AI chat with additional styles is generally clean and functional, but there are a couple of minor suggestions and corrections: Suggested Corrections/Improvements
Below is the revised version of your code incorporating some of these considerations: <template>
<div ref="aiChatRef" class="ai-chat" :class="type" :style="[...baseStyles, customStyles]">
<!-- Your existing content here -->
</div>
</template>
<script setup lang="ts">
import { ref, defineExpose} from 'vue';
const aiChatRef = ref(null);
const firsUserInput = reactive(false);
// Define your props and other necessary variables
defineExpose({
// Export your expose methods here
});
</script>
<style scoped>
.ai-chat {
height: 100%;
display: flex;
justify-content: center;
align-items: center; /* Removed unnecessary padding */
}
.user-form-container {
/* Add default styling as needed */
max-width: 70%; /* Adjusted based on your needs */
}
.debug-ai-chat {
.user-form-container {
max-width: 100%; /* Ensures wider than default on smaller screens */
}
}
.popperUserInput {
position: absolute;
background-color: #fff;
border-radius: 8px;
font-size: 16px;
padding: 1rem;
z-index: 1000;
width: calc(100% - 50px);
max-width: 400px;
}
@media only screen and (max-width: 768px) {
.firstUserInput {
.user-form-container {
max-width: 100%; /* Always ensures wide form container on mobile */
}
}
}
</style> By making these adjustments and optimizations, your AI chat component will be more efficient, maintainable, and responsive across devices. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,22 +116,33 @@ | |
/> | ||
</el-form-item> | ||
|
||
<el-form-item> | ||
<div class="flex-between mb-16"> | ||
<div class="lighter">{{ $t('views.applicationWorkflow.nodes.mcpNode.tool') }}</div> | ||
<el-button type="primary" link @click="openMcpServersDialog" @refreshForm="refreshParam"> | ||
<el-icon><Setting /></el-icon> | ||
</el-button> | ||
</div> | ||
|
||
<el-form-item @click.prevent> | ||
<template #label> | ||
<div class="flex-between"> | ||
<div>{{ $t('views.applicationWorkflow.nodes.mcpNode.tool') }}</div> | ||
<div class="flex-between w-full"> | ||
<div> | ||
<span>{{ | ||
$t('views.application.applicationForm.form.reasoningContent.label') | ||
}}</span> | ||
</div> | ||
<el-button | ||
type="primary" | ||
link | ||
@click="openMcpServersDialog" | ||
@click="openReasoningParamSettingDialog" | ||
@refreshForm="refreshParam" | ||
> | ||
<el-icon><Setting /></el-icon> | ||
</el-button> | ||
</div> | ||
</template> | ||
<el-switch size="small" v-model="chat_data.model_setting.reasoning_content_enable" /> | ||
</el-form-item> | ||
|
||
<el-form-item @click.prevent> | ||
<template #label> | ||
<div class="flex align-center"> | ||
|
@@ -151,26 +162,6 @@ | |
</template> | ||
<el-switch size="small" v-model="chat_data.is_result" /> | ||
</el-form-item> | ||
<el-form-item @click.prevent> | ||
<template #label> | ||
<div class="flex-between w-full"> | ||
<div> | ||
<span>{{ | ||
$t('views.application.applicationForm.form.reasoningContent.label') | ||
}}</span> | ||
</div> | ||
<el-button | ||
type="primary" | ||
link | ||
@click="openReasoningParamSettingDialog" | ||
@refreshForm="refreshParam" | ||
> | ||
<el-icon><Setting /></el-icon> | ||
</el-button> | ||
</div> | ||
</template> | ||
<el-switch size="small" v-model="chat_data.model_setting.reasoning_content_enable" /> | ||
</el-form-item> | ||
</el-form> | ||
</el-card> | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code contains some formatting discrepancies and redundancy. Here are my recommendations:
Here's what the updated code should look like:
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no significant issues with the provided code snippet. It appears to be maintaining proper logic for displaying input fields based on various conditions and handling form submissions.
Optimization suggestions include:
These changes can help improve maintainability and readability of the codebase.