Skip to content

Commit

Permalink
优化docker打包镜像文件过大的问题 (#415)
Browse files Browse the repository at this point in the history
* chore: 更新文档

* Improve zh-TW locale (#379)

* fix: 移动端样式

* feat: typo

* fix: 调整滚动回原样

* ⚡优化docker打包镜像文件过大

---------

Co-authored-by: ChenZhaoYu <790348264@qq.com>
Co-authored-by: Peter Dave Hello <hsu@peterdavehello.org>
  • Loading branch information
3 people committed Mar 9, 2023
1 parent 7db8727 commit 9d4d35d
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 45 deletions.
8 changes: 4 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**/node_modules
*/node_modules
node_modules
Dockerfile
.git
.husky
.github
.vscode
.*
*/.*
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ FROM node:lts-alpine AS builder
COPY ./ /app
WORKDIR /app

RUN npm install pnpm -g && pnpm install && pnpm run build
RUN apk add --no-cache git \
&& npm install pnpm -g \
&& pnpm install \
&& pnpm run build \
&& rm -rf /root/.npm /root/.pnpm-store /usr/local/share/.cache /tmp/*

# service
FROM node:lts-alpine
Expand All @@ -13,8 +17,12 @@ COPY /service /app
COPY --from=builder /app/dist /app/public

WORKDIR /app
RUN npm install pnpm -g && pnpm install
RUN apk add --no-cache git \
&& npm install pnpm -g \
&& pnpm install --only=production \
&& rm -rf /root/.npm /root/.pnpm-store /usr/local/share/.cache /tmp/*


EXPOSE 3002

CMD ["pnpm", "run", "start"]
CMD ["pnpm", "run", "start"]
6 changes: 6 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ For all parameter variables, check [here](#docker-parameter-example) or see:

[] Formatting and beautifying code-like message types

[] Access rights control

[] Data import and export

[] Save message to local image

[] Multilingual interface

[] Interface themes
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ API_REVERSE_PROXY=

[] 对代码等消息类型的格式化美化处理

[] 访问权限控制

[] 数据导入、导出

[] 保存消息到本地图片

[] 界面多语言

[] 界面主题
Expand Down
64 changes: 34 additions & 30 deletions src/components/common/Setting/General.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const themeOptions: { label: string; key: Theme; icon: string }[] = [
]
const languageOptions: { label: string; key: Language; value: Language }[] = [
{ label: '中文', key: 'zh-CN', value: 'zh-CN' },
{ label: '简体中文', key: 'zh-CN', value: 'zh-CN' },
{ label: '繁體中文', key: 'zh-TW', value: 'zh-TW' },
{ label: 'English', key: 'en-US', value: 'en-US' },
]
Expand Down Expand Up @@ -151,38 +151,41 @@ function handleImportButtonClick(): void {
<div class="flex items-center space-x-4">
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.chatHistory') }}</span>

<NButton @click="exportData">
<template #icon>
<SvgIcon icon="ri:download-2-fill" />
</template>
{{ $t('common.export') }}
</NButton>

<input id="fileInput" type="file" style="display:none" @change="importData">
<NButton @click="handleImportButtonClick">
<template #icon>
<SvgIcon icon="ri:upload-2-fill" />
</template>
{{ $t('common.import') }}
</NButton>

<NPopconfirm placement="bottom" @positive-click="clearData">
<template #trigger>
<NButton>
<template #icon>
<SvgIcon icon="ri:close-circle-line" />
</template>
{{ $t('common.clear') }}
</NButton>
</template>
{{ $t('chat.clearHistoryConfirm') }}
</NPopconfirm>
<div class="flex flex-wrap items-center gap-4">
<NButton size="small" @click="exportData">
<template #icon>
<SvgIcon icon="ri:download-2-fill" />
</template>
{{ $t('common.export') }}
</NButton>

<input id="fileInput" type="file" style="display:none" @change="importData">
<NButton size="small" @click="handleImportButtonClick">
<template #icon>
<SvgIcon icon="ri:upload-2-fill" />
</template>
{{ $t('common.import') }}
</NButton>

<NPopconfirm placement="bottom" @positive-click="clearData">
<template #trigger>
<NButton size="small">
<template #icon>
<SvgIcon icon="ri:close-circle-line" />
</template>
{{ $t('common.clear') }}
</NButton>
</template>
{{ $t('chat.clearHistoryConfirm') }}
</NPopconfirm>
</div>
</div>
<div class="flex items-center space-x-4">
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.theme') }}</span>
<div class="flex items-center space-x-4">
<div class="flex flex-wrap items-center gap-4">
<template v-for="item of themeOptions" :key="item.key">
<NButton
size="small"
:type="item.key === theme ? 'primary' : undefined"
@click="appStore.setTheme(item.key)"
>
Expand All @@ -195,9 +198,10 @@ function handleImportButtonClick(): void {
</div>
<div class="flex items-center space-x-4">
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.language') }}</span>
<div class="flex items-center space-x-4">
<div class="flex flex-wrap items-center gap-4">
<template v-for="item of languageOptions" :key="item.key">
<NButton
size="small"
:type="item.key === language ? 'primary' : undefined"
@click="appStore.setLanguage(item.key)"
>
Expand All @@ -208,7 +212,7 @@ function handleImportButtonClick(): void {
</div>
<div class="flex items-center space-x-4">
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.resetUserInfo') }}</span>
<NButton @click="handleReset">
<NButton size="small" @click="handleReset">
{{ $t('common.reset') }}
</NButton>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/Setting/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const show = computed({

<template>
<NModal v-model:show="show" :auto-focus="false">
<NCard role="dialog" aria-modal="true" :bordered="false" style="width: 100%; max-width: 640px">
<NCard role="dialog" aria-modal="true" :bordered="false" style="width: 95%; max-width: 640px">
<NTabs v-model:value="active" type="line" animated>
<NTabPane name="General" tab="General">
<template #tab>
Expand Down
2 changes: 1 addition & 1 deletion src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
unauthorizedTips: '未经授权,请先进行验证。',
},
chat: {
placeholder: '来说点什么...(Shift + Enter = 换行)',
placeholder: '来说点什么吧...(Shift + Enter = 换行)',
placeholderMobile: '来说点什么...',
copy: '复制',
copied: '复制成功',
Expand Down
13 changes: 7 additions & 6 deletions src/locales/zh-TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ export default {
delete: '刪除',
save: '儲存',
reset: '重設',
export: '導出',
import: '導入',
clear: '清空',
export: '匯出',
import: '匯入',
clear: '清除',
yes: '是',
no: '否',
noData: '暫無資料',
Expand All @@ -16,12 +16,12 @@ export default {
unauthorizedTips: '未經授權,請先進行驗證。',
},
chat: {
placeholder: '來講點什麼...(Shift + Enter = 換行)',
placeholderMobile: '來講點什麼...',
placeholder: '來說點什麼...(Shift + Enter = 換行)',
placeholderMobile: '來說點什麼...',
copy: '複製',
copied: '複製成功',
copyCode: '複製代碼',
clearChat: '清空對話',
clearChat: '清除對話',
clearChatConfirm: '是否清空對話?',
exportImage: '儲存對話為圖片',
exportImageConfirm: '是否將對話儲存為圖片?',
Expand All @@ -39,6 +39,7 @@ export default {
name: '名稱',
description: '描述',
resetUserInfo: '重設使用者資訊',
chatHistory: '紀錄',
theme: '主題',
language: '語言',
api: 'API',
Expand Down
1 change: 1 addition & 0 deletions src/views/chat/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ async function onConversation() {
requestOptions: { prompt: message, options: { ...options } },
},
)
scrollToBottom()
}
catch (error) {
//
Expand Down

0 comments on commit 9d4d35d

Please sign in to comment.