Webui: improve scroll and bug fixes (#1082)

* Webui: fix message scroll back due to setPending

smooth scroll

remove throttle

increase scroll margin

# Conflicts:
#	examples/server/public/index.html.gz
#	examples/server/webui/dist/index.html
#	examples/server/webui/src/utils/app.context.tsx

* webui: don't scroll to bottom when conversation changes or edit message

# Conflicts:
#	examples/server/public/index.html.gz
#	examples/server/webui/dist/index.html

* Webui: fix save config error

# Conflicts:
#	examples/server/public/index.html.gz
#	examples/server/webui/dist/index.html

* Webui: add api key to request model name

# Conflicts:
#	examples/server/public/index.html.gz
#	examples/server/webui/dist/index.html

* Update

* webui: fix loading dots display issue

# Conflicts:
#	examples/server/public/index.html.gz
#	examples/server/webui/dist/index.html
#	examples/server/webui/src/components/ChatMessage.tsx

* Webui: cancel scroll when user moves up

---------

Co-authored-by: firecoperana <firecoperana>
This commit is contained in:
firecoperana
2025-12-24 05:30:26 -06:00
committed by GitHub
parent 0d7eb34185
commit 903377bc34
8 changed files with 147 additions and 101 deletions

View File

@@ -133,13 +133,17 @@ export const AppContextProvider = ({
const setPending = (convId: string, pendingMsg: PendingMessage | null) => {
// if pendingMsg is null, remove the key from the object
if (!pendingMsg) {
setPendingMessages((prev) => {
const newState = { ...prev };
delete newState[convId];
return newState;
});
setTimeout(() => {
setPendingMessages((prev) => {
const newState = { ...prev };
delete newState[convId];
return newState;
});
}, 100); // Adjust delay as needed
} else {
setPendingMessages((prev) => ({ ...prev, [convId]: pendingMsg }));
setTimeout(() => {
setPendingMessages((prev) => ({ ...prev, [convId]: pendingMsg }));
}, 100);
}
};
@@ -157,7 +161,6 @@ export const AppContextProvider = ({
////////////////////////////////////////////////////////////////////////
// public functions
const isGenerating = (convId: string) => !!pendingMessages[convId];
const generateMessage = async (
@@ -378,7 +381,7 @@ export const AppContextProvider = ({
const currMsgId = now;
let model_name:string='';
await getServerProps(BASE_URL)
await getServerProps(BASE_URL, config.apiKey)
.then((props) => {
console.debug('Server props:', props);
model_name = props.model_name;
@@ -433,7 +436,7 @@ export const AppContextProvider = ({
const currMsgId = now;
let model_name:string='';
await getServerProps(BASE_URL)
await getServerProps(BASE_URL, config.apiKey)
.then((props) => {
console.debug('Server props:', props);
model_name = props.model_name;

View File

@@ -125,9 +125,10 @@ const StorageUtils = {
async createConversation(name: string): Promise<Conversation> {
const now = Date.now();
const msgId = now;
const config = StorageUtils.getConfig();
let model_name:string = '';
//window.alert(BASE_URL);
await getServerProps(BASE_URL)
await getServerProps(BASE_URL, config.apiKey)
.then((props) => {
console.debug('Server props:', props);
model_name = props.model_name;