Merge branch 'Yidadaa:main' into hugoyue-patch-1

This commit is contained in:
hugoyue 2023-04-01 23:31:17 +08:00 committed by GitHub
commit 13fcc902a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 23 deletions

View File

@ -1,16 +1,29 @@
# .github/workflows/sync.yml name: Upstream Sync
name: Sync Fork
on: on:
schedule: schedule:
- cron: "0 8 * * *" # 每天0点触发 - cron: '0 */12 * * *' # every 12 hours
workflow_dispatch: # on button click
jobs: jobs:
repo-sync: sync_latest_from_upstream:
name: Sync latest commits from upstream repo
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: TG908/fork-sync@v1.1 # Step 1: run a standard checkout action, provided by github
- name: Checkout target repo
uses: actions/checkout@v3
# Step 2: run the sync action
- name: Sync upstream changes
id: sync
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} # 这个 token action 会默认配置, 这里只需这样写就行 upstream_sync_repo: Yidadaa/ChatGPT-Next-Web
owner: Yidadaa # fork 上游项目 owner upstream_sync_branch: main
head: main # fork 上游项目需要同步的分支 target_sync_branch: main
base: main # 需要同步到本项目的目标分支 target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set
# Set test_mode true to run tests instead of the true action!!
test_mode: false

View File

@ -108,7 +108,7 @@ export function ChatList() {
state.currentSessionIndex, state.currentSessionIndex,
state.selectSession, state.selectSession,
state.removeSession, state.removeSession,
], ]
); );
return ( return (
@ -121,7 +121,7 @@ export function ChatList() {
key={i} key={i}
selected={i === selectedIndex} selected={i === selectedIndex}
onClick={() => selectSession(i)} onClick={() => selectSession(i)}
onDelete={() => removeSession(i)} onDelete={() => confirm(Locale.Home.DeleteChat) && removeSession(i)}
/> />
))} ))}
</div> </div>
@ -202,7 +202,7 @@ export function Chat(props: {
setPromptHints(promptStore.search(text)); setPromptHints(promptStore.search(text));
}, },
100, 100,
{ leading: true, trailing: true }, { leading: true, trailing: true }
); );
const onPromptSelect = (prompt: Prompt) => { const onPromptSelect = (prompt: Prompt) => {
@ -216,7 +216,7 @@ export function Chat(props: {
if (!dom) return; if (!dom) return;
const paddingBottomNum: number = parseInt( const paddingBottomNum: number = parseInt(
window.getComputedStyle(dom).paddingBottom, window.getComputedStyle(dom).paddingBottom,
10, 10
); );
dom.scrollTop = dom.scrollHeight - dom.offsetHeight + paddingBottomNum; dom.scrollTop = dom.scrollHeight - dom.offsetHeight + paddingBottomNum;
}; };
@ -304,7 +304,7 @@ export function Chat(props: {
preview: true, preview: true,
}, },
] ]
: [], : []
) )
.concat( .concat(
userInput.length > 0 userInput.length > 0
@ -316,7 +316,7 @@ export function Chat(props: {
preview: true, preview: true,
}, },
] ]
: [], : []
); );
// auto scroll // auto scroll
@ -354,7 +354,7 @@ export function Chat(props: {
const newTopic = prompt(Locale.Chat.Rename, session.topic); const newTopic = prompt(Locale.Chat.Rename, session.topic);
if (newTopic && newTopic !== session.topic) { if (newTopic && newTopic !== session.topic) {
chatStore.updateCurrentSession( chatStore.updateCurrentSession(
(session) => (session.topic = newTopic!), (session) => (session.topic = newTopic!)
); );
} }
}} }}
@ -453,7 +453,10 @@ export function Chat(props: {
className="markdown-body" className="markdown-body"
style={{ fontSize: `${fontSize}px` }} style={{ fontSize: `${fontSize}px` }}
onContextMenu={(e) => onRightClick(e, message)} onContextMenu={(e) => onRightClick(e, message)}
onDoubleClickCapture={() => setUserInput(message.content)} onDoubleClickCapture={() => {
if (!isMobileScreen()) return;
setUserInput(message.content);
}}
> >
<Markdown content={message.content} /> <Markdown content={message.content} />
</div> </div>
@ -470,7 +473,7 @@ export function Chat(props: {
</div> </div>
); );
})} })}
<div ref={latestMessageRef} style={{ opacity: 0, height: "4em" }}> <div ref={latestMessageRef} style={{ opacity: 0, height: "1px" }}>
- -
</div> </div>
</div> </div>
@ -600,7 +603,7 @@ export function Home() {
state.newSession, state.newSession,
state.currentSessionIndex, state.currentSessionIndex,
state.removeSession, state.removeSession,
], ]
); );
const loading = !useHasHydrated(); const loading = !useHasHydrated();
const [showSideBar, setShowSideBar] = useState(true); const [showSideBar, setShowSideBar] = useState(true);