This commit is contained in:
GH Action - Upstream Sync 2023-04-05 18:24:37 +00:00
commit 03766c4fdc
7 changed files with 132 additions and 13 deletions

43
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,43 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
** Deployment
- [ ] Docker
- [ ] Vercel
- [ ] Server
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional Logs**
Add any logs about the problem here.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

20
.github/ISSUE_TEMPLATE/功能建议.md vendored Normal file
View File

@ -0,0 +1,20 @@
---
name: 功能建议
about: 请告诉我们你的灵光一闪
title: "[Feature] "
labels: ''
assignees: ''
---
**这个功能与现有的问题有关吗?**
如果有关,请在此列出链接或者描述问题。
**你想要什么功能或者有什么建议?**
尽管告诉我们。
**有没有可以参考的同类竞品?**
可以给出参考产品的链接或者截图。
**其他信息**
可以说说你的其他考虑。

23
.github/ISSUE_TEMPLATE/反馈问题.md vendored Normal file
View File

@ -0,0 +1,23 @@
---
name: 反馈问题
about: 请告诉我们你遇到的问题
title: "[Bug] "
labels: ''
assignees: ''
---
**描述问题**
请在此描述你遇到了什么问题。
**如何复现**
请告诉我们你是通过什么操作触发的该问题。
**截图**
请在此提供控制台截图、屏幕截图或者服务端的 log 截图。
**一些必要的信息**
- 系统:[比如 windows 10/ macos 12/ linux / android 11 / ios 16]
- 浏览器: [比如 chrome, safari]
- 版本: [填写设置页面的版本号]
- 部署方式:[比如 vercel、docker 或者服务器部署]

View File

@ -17,6 +17,7 @@ import { Message, SubmitKey, useChatStore, BOT_HELLO, ROLES } from "../store";
import { import {
copyToClipboard, copyToClipboard,
downloadAs, downloadAs,
getEmojiUrl,
isMobileScreen, isMobileScreen,
selectOrCopy, selectOrCopy,
} from "../utils"; } from "../utils";
@ -50,7 +51,7 @@ export function Avatar(props: { role: Message["role"] }) {
return ( return (
<div className={styles["user-avtar"]}> <div className={styles["user-avtar"]}>
<Emoji unified={config.avatar} size={18} /> <Emoji unified={config.avatar} size={18} getEmojiUrl={getEmojiUrl} />
</div> </div>
); );
} }

View File

@ -26,7 +26,7 @@ import {
import { Avatar } from "./chat"; import { Avatar } from "./chat";
import Locale, { AllLangs, changeLang, getLang } from "../locales"; import Locale, { AllLangs, changeLang, getLang } from "../locales";
import { getCurrentVersion } from "../utils"; import { getCurrentVersion, getEmojiUrl } from "../utils";
import Link from "next/link"; import Link from "next/link";
import { UPDATE_URL } from "../constant"; import { UPDATE_URL } from "../constant";
import { SearchService, usePromptStore } from "../store/prompt"; import { SearchService, usePromptStore } from "../store/prompt";
@ -181,6 +181,7 @@ export function Settings(props: { closeSettings: () => void }) {
<EmojiPicker <EmojiPicker
lazyLoadEmojis lazyLoadEmojis
theme={EmojiTheme.AUTO} theme={EmojiTheme.AUTO}
getEmojiUrl={getEmojiUrl}
onEmojiClick={(e) => { onEmojiClick={(e) => {
updateConfig((config) => (config.avatar = e.unified)); updateConfig((config) => (config.avatar = e.unified));
setShowEmojiPicker(false); setShowEmojiPicker(false);

View File

@ -1,3 +1,4 @@
import { EmojiStyle } from "emoji-picker-react";
import { showToast } from "./components/ui-lib"; import { showToast } from "./components/ui-lib";
import Locale from "./locales"; import Locale from "./locales";
@ -6,17 +7,23 @@ export function trimTopic(topic: string) {
} }
export async function copyToClipboard(text: string) { export async function copyToClipboard(text: string) {
if (navigator.clipboard) {
navigator.clipboard.writeText(text).catch(err => {
console.error('Failed to copy: ', err);
});
} else {
const textArea = document.createElement('textarea');
textArea.value = text;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try { try {
await navigator.clipboard.writeText(text); document.execCommand('copy');
} catch (error) { console.log('Text copied to clipboard');
const textarea = document.createElement("textarea"); } catch (err) {
textarea.value = text; console.error('Failed to copy: ', err);
document.body.appendChild(textarea); }
textarea.select(); document.body.removeChild(textArea);
document.execCommand("copy");
document.body.removeChild(textarea);
} finally {
showToast(Locale.Copy.Success);
} }
} }
@ -81,3 +88,7 @@ export function getCurrentVersion() {
return currentId; return currentId;
} }
export function getEmojiUrl(unified: string, style: EmojiStyle) {
return `https://cdn.staticfile.org/emoji-datasource-apple/14.0.0/img/${style}/64/${unified}.png`;
}