Skip to content

Commit

Permalink
2.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Dooy committed Dec 20, 2023
1 parent 4172cce commit 61aeaa7
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 11 deletions.
4 changes: 2 additions & 2 deletions changlog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## 2.13.1
- 🐞 修复: gpts 加载排序
- 😄 新建: google、百度统计
- 😄 新建: 文件支持拖拽上传 #39
- 😄 新增: google、百度统计
- 😄 新增: 文件支持拖拽上传、粘贴截图上传 #39


## 2.12.11
Expand Down
22 changes: 22 additions & 0 deletions src/api/mjapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,25 @@ export const loadGallery = async ()=>{
if( d.length>0 ) localSaveAny({ctime: Date.now(), d}, localKey);
return d as any[] ;
}


export function getFileFromClipboard(event:any ){
let rz=[];
if ( event.clipboardData || event.originalEvent ) {
let clipboardData = (event.clipboardData || event.originalEvent.clipboardData);
if (clipboardData.items) {
let items = clipboardData.items;
// mlog('getFileFromClipboard', items );
for (let i = 0; i < items.length; i++) {
if (items[i].type.indexOf("image") !== -1 || items[i].kind === 'file') {
//rz.push( await fileToBase64( items[i].getAsFile()) );
//mlog('fff', items[i] );
rz.push( items[i].getAsFile())
}
}

}
}
//console.log('passs>>' ,rz );
return rz;
}
3 changes: 2 additions & 1 deletion src/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export default {
},
chat: {
newChatButton: 'New Chat',
placeholder: 'Ask me anything...(Shift + Enter = line break, "/" to trigger prompts)',
//placeholder: 'Ask me anything...(Shift + Enter = line break, "/" to trigger prompts)',
placeholder: 'Ask me anything, or paste screenshots or drag the file .(Shift + Enter = line break, "/" to trigger prompts)',
placeholderMobile: 'Ask me anything...',
copy: 'Copy',
copied: 'Copied',
Expand Down
3 changes: 2 additions & 1 deletion src/locales/ko-KR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export default {
},
chat: {
newChatButton: '새로운 채팅',
placeholder: '무엇이든 물어보세요...(Shift + Enter = 줄바꿈, "/"를 눌러서 힌트를 보세요)',
//placeholder: '무엇이든 물어보세요...(Shift + Enter = 줄바꿈, "/"를 눌러서 힌트를 보세요)',
placeholder: '할 말을 입력하거나 스크린샷을 붙여넣거나 파일을 드래그 앤 드롭할 수 있습니다.',
placeholderMobile: '무엇이든 물어보세요...',
copy: '복사',
copied: '복사됨',
Expand Down
3 changes: 2 additions & 1 deletion src/locales/ru-RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export default {
},
chat: {
newChatButton: 'Новый чат',
placeholder: 'Спросите меня о чем-нибудь ... (Shift + Enter = перенос строки, "/" для вызова подсказок)',
//placeholder: 'Спросите меня о чем-нибудь ... (Shift + Enter = перенос строки, "/" для вызова подсказок)',
placeholder: 'Вы можете ввести что-то сказать, или вы можете вставить скриншоты или перетащить файлы.',
placeholderMobile: 'Спросите меня о чем-нибудь ...',
copy: 'Копировать',
copied: 'Скопировано',
Expand Down
3 changes: 2 additions & 1 deletion src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export default {
},
chat: {
newChatButton: '新建聊天',
placeholder: '来说点什么吧...(Shift + Enter = 换行,"/" 触发提示词)',
//placeholder: '来说点什么吧...(Shift + Enter = 换行,"/" 触发提示词)',
placeholder: '可输入说点什么,也可贴截图或拖拽文件(Shift + Enter = 换行,"/" 触发提示词)',
placeholderMobile: '来说点什么...',
copy: '复制',
copied: '复制成功',
Expand Down
3 changes: 2 additions & 1 deletion src/locales/zh-TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export default {
},
chat: {
newChatButton: '新增對話',
placeholder: '來說點什麼...(Shift + Enter = 換行,"/" 觸發提示詞)',
//placeholder: '來說點什麼...(Shift + Enter = 換行,"/" 觸發提示詞)',
placeholder: '可輸入說點什麼,也可貼截圖或拖拽檔案(Shift + Enter = 換行,"/" 觸發提示詞)',
placeholderMobile: '來說點什麼...',
copy: '複製',
copied: '複製成功',
Expand Down
12 changes: 8 additions & 4 deletions src/views/mj/aiGptInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useBasicLayout } from '@/hooks/useBasicLayout'
import { t } from '@/locales'
import { NInput ,NButton,useMessage,NImage,NTooltip, NAutoComplete } from 'naive-ui'
import { SvgIcon } from '@/components/common';
import { canVisionModel, GptUploader, mlog, upImg } from '@/api';
import { canVisionModel, GptUploader, mlog, upImg,getFileFromClipboard } from '@/api';
import { gptConfigStore, homeStore } from '@/store';
import { AutoCompleteOptions } from 'naive-ui/es/auto-complete/src/interface';
import { RenderLabel } from 'naive-ui/es/_internal/select-menu/src/interface';
Expand All @@ -18,7 +18,7 @@ const { isMobile } = useBasicLayout()
const placeholder = computed(() => {
if (isMobile.value)
return t('chat.placeholderMobile')
return t('chat.placeholder')
return t('chat.placeholder');//可输入说点什么,也可贴截图或拖拽文件
})
const handleSubmit = ( ) => {
Expand Down Expand Up @@ -136,9 +136,13 @@ const drop = (e: DragEvent) => {
upFile(files[0]);
//mlog('drop', files);
}
const paste= (e: ClipboardEvent)=>{
let rz = getFileFromClipboard(e);
if(rz.length>0 ) upFile(rz[0]);
}
</script>
<template>
<div class=" myinputs" @drop="drop" >
<div class=" myinputs" @drop="drop" @paste="paste">

<input type="file" id="fileInput" @change="selectFile" class="hidden" ref="fsRef" :accept="acceptData"/>

Expand All @@ -160,7 +164,7 @@ const drop = (e: DragEvent) => {
:placeholder="placeholder" :autosize="{ minRows: 1, maxRows: isMobile ? 4 : 8 }"
@input="handleInput"
@focus="handleFocus"
@blur="handleBlur"
@blur="handleBlur"
@keypress="handleEnter" >
<template #prefix>
<div class=" relative; w-[22px]">
Expand Down

0 comments on commit 61aeaa7

Please sign in to comment.