select chat index after fetch
This commit is contained in:
@@ -205,7 +205,12 @@ export function App() {
|
|||||||
DEL
|
DEL
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<ChatBOX chatStore={chatStore} setChatStore={setChatStore} />
|
<ChatBOX
|
||||||
|
chatStore={chatStore}
|
||||||
|
setChatStore={setChatStore}
|
||||||
|
selectedChatIndex={selectedChatIndex}
|
||||||
|
setSelectedChatIndex={setSelectedChatIndex}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { createRef } from "preact";
|
import { createRef } from "preact";
|
||||||
import { useEffect, useState } from "preact/hooks";
|
import { StateUpdater, useEffect, useState } from "preact/hooks";
|
||||||
import type { ChatStore } from "./app";
|
import type { ChatStore } from "./app";
|
||||||
import ChatGPT, { ChunkMessage, FetchResponse } from "./chatgpt";
|
import ChatGPT, { ChunkMessage, FetchResponse } from "./chatgpt";
|
||||||
import Message from "./message";
|
import Message from "./message";
|
||||||
@@ -8,6 +8,8 @@ import Settings from "./settings";
|
|||||||
export default function ChatBOX(props: {
|
export default function ChatBOX(props: {
|
||||||
chatStore: ChatStore;
|
chatStore: ChatStore;
|
||||||
setChatStore: (cs: ChatStore) => void;
|
setChatStore: (cs: ChatStore) => void;
|
||||||
|
selectedChatIndex: number;
|
||||||
|
setSelectedChatIndex: StateUpdater<number>;
|
||||||
}) {
|
}) {
|
||||||
const { chatStore, setChatStore } = props;
|
const { chatStore, setChatStore } = props;
|
||||||
// prevent error
|
// prevent error
|
||||||
@@ -134,6 +136,7 @@ export default function ChatBOX(props: {
|
|||||||
alert(error);
|
alert(error);
|
||||||
} finally {
|
} finally {
|
||||||
setShowGenerating(false);
|
setShowGenerating(false);
|
||||||
|
props.setSelectedChatIndex(props.selectedChatIndex);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -205,7 +208,7 @@ export default function ChatBOX(props: {
|
|||||||
<br />
|
<br />
|
||||||
⚙Endpoint: {chatStore.apiEndpoint}
|
⚙Endpoint: {chatStore.apiEndpoint}
|
||||||
<br />
|
<br />
|
||||||
⬆点击上方更改此对话的参数
|
⬆点击上方更改此对话的参数(请勿泄漏)
|
||||||
<br />
|
<br />
|
||||||
↖点击左上角 NEW 新建对话
|
↖点击左上角 NEW 新建对话
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
Reference in New Issue
Block a user