瀏覽代碼

Merge pull request #951 from open-webui/dev

0.1.106
Timothy Jaeryang Baek 1 年之前
父節點
當前提交
a181b2b63b

+ 13 - 0
CHANGELOG.md

@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
 
+## [0.1.106] - 2024-02-27
+
+### Added
+
+- **🎯 Auto-focus Feature**: The input area now automatically focuses when initiating or opening a chat conversation.
+
+### Fixed
+
+- Corrected typo from "HuggingFace" to "Hugging Face" (Issue #924).
+- Resolved bug causing errors in chat completion API calls to OpenAI due to missing "num_ctx" parameter (Issue #927).
+- Fixed issues preventing text editing, selection, and cursor retention in the input field (Issue #940).
+- Fixed a bug where defining an OpenAI-compatible API server using 'OPENAI_API_BASE_URL' containing 'openai' string resulted in hiding models not containing 'gpt' string from the model menu. (Issue #930)
+
 ## [0.1.105] - 2024-02-25
 ## [0.1.105] - 2024-02-25
 
 
 ### Added
 ### Added

+ 10 - 0
README.md

@@ -160,6 +160,16 @@ This project is licensed under the [MIT License](LICENSE) - see the [LICENSE](LI
 If you have any questions, suggestions, or need assistance, please open an issue or join our
 If you have any questions, suggestions, or need assistance, please open an issue or join our
 [Open WebUI Discord community](https://discord.gg/5rJgQTnV4s) to connect with us! 🤝
 [Open WebUI Discord community](https://discord.gg/5rJgQTnV4s) to connect with us! 🤝
 
 
+## Star History
+
+<a href="https://star-history.com/#open-webui/open-webui&Date">
+  <picture>
+    <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=open-webui/open-webui&type=Date&theme=dark" />
+    <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=open-webui/open-webui&type=Date" />
+    <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=open-webui/open-webui&type=Date" />
+  </picture>
+</a>
+
 ---
 ---
 
 
 Created by [Timothy J. Baek](https://github.com/tjbck) - Let's make Open Web UI even more amazing together! 💪
 Created by [Timothy J. Baek](https://github.com/tjbck) - Let's make Open Web UI even more amazing together! 💪

+ 8 - 1
backend/apps/openai/main.py

@@ -146,6 +146,13 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
                 body["max_tokens"] = 4000
                 body["max_tokens"] = 4000
             print("Modified body_dict:", body)
             print("Modified body_dict:", body)
 
 
+        # Fix for ChatGPT calls failing because the num_ctx key is in body
+        if "num_ctx" in body:
+            # If 'num_ctx' is in the dictionary, delete it
+            # Leaving it there generates an error with the
+            # OpenAI API (Feb 2024)
+            del body["num_ctx"]
+
         # Convert the modified body back to JSON
         # Convert the modified body back to JSON
         body = json.dumps(body)
         body = json.dumps(body)
     except json.JSONDecodeError as e:
     except json.JSONDecodeError as e:
@@ -184,7 +191,7 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
 
 
             response_data = r.json()
             response_data = r.json()
 
 
-            if "openai" in app.state.OPENAI_API_BASE_URL and path == "models":
+            if "api.openai.com" in app.state.OPENAI_API_BASE_URL and path == "models":
                 response_data["data"] = list(
                 response_data["data"] = list(
                     filter(lambda model: "gpt" in model["id"], response_data["data"])
                     filter(lambda model: "gpt" in model["id"], response_data["data"])
                 )
                 )

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
 	"name": "open-webui",
 	"name": "open-webui",
-	"version": "0.1.105",
+	"version": "0.1.106",
 	"private": true,
 	"private": true,
 	"scripts": {
 	"scripts": {
 		"dev": "vite dev --host",
 		"dev": "vite dev --host",

+ 3 - 0
src/lib/components/chat/MessageInput.svelte

@@ -293,6 +293,9 @@
 	};
 	};
 
 
 	onMount(() => {
 	onMount(() => {
+		const chatInput = document.getElementById('chat-textarea');
+		window.setTimeout(() => chatInput?.focus(), 0);
+
 		const dropZone = document.querySelector('body');
 		const dropZone = document.querySelector('body');
 
 
 		const onDragOver = (e) => {
 		const onDragOver = (e) => {

+ 1 - 1
src/lib/components/chat/Settings/Models.svelte

@@ -580,7 +580,7 @@
 											type="url"
 											type="url"
 											required
 											required
 											bind:value={modelFileUrl}
 											bind:value={modelFileUrl}
-											placeholder="Type HuggingFace Resolve (Download) URL"
+											placeholder="Type Hugging Face Resolve (Download) URL"
 										/>
 										/>
 									</div>
 									</div>
 								{/if}
 								{/if}

+ 11 - 9
src/lib/components/layout/Sidebar.svelte

@@ -31,6 +31,7 @@
 	let chatTitle = '';
 	let chatTitle = '';
 
 
 	let showDropdown = false;
 	let showDropdown = false;
+	let isEditing = false;
 
 
 	onMount(async () => {
 	onMount(async () => {
 		if (window.innerWidth > 1280) {
 		if (window.innerWidth > 1280) {
@@ -101,17 +102,16 @@
 			: 'invisible'}"
 			: 'invisible'}"
 	>
 	>
 		<div class="px-2 flex justify-center space-x-2">
 		<div class="px-2 flex justify-center space-x-2">
-			<button
+			<a
 				id="sidebar-new-chat-button"
 				id="sidebar-new-chat-button"
 				class="flex-grow flex justify-between rounded-xl px-3.5 py-2 hover:bg-gray-900 transition"
 				class="flex-grow flex justify-between rounded-xl px-3.5 py-2 hover:bg-gray-900 transition"
+				href="/"
 				on:click={async () => {
 				on:click={async () => {
-					goto('/');
-
+					await goto('/');
 					const newChatButton = document.getElementById('new-chat-button');
 					const newChatButton = document.getElementById('new-chat-button');
-
-					if (newChatButton) {
-						newChatButton.click();
-					}
+					setTimeout(() => {
+						newChatButton?.click();
+					}, 0);
 				}}
 				}}
 			>
 			>
 				<div class="flex self-center">
 				<div class="flex self-center">
@@ -141,7 +141,7 @@
 						/>
 						/>
 					</svg>
 					</svg>
 				</div>
 				</div>
-			</button>
+			</a>
 		</div>
 		</div>
 
 
 		{#if $user?.role === 'admin'}
 		{#if $user?.role === 'admin'}
@@ -372,6 +372,7 @@
 								? 'bg-gray-900'
 								? 'bg-gray-900'
 								: ''} transition whitespace-nowrap text-ellipsis"
 								: ''} transition whitespace-nowrap text-ellipsis"
 							href="/c/{chat.id}"
 							href="/c/{chat.id}"
+							draggable={isEditing ? 'false' : 'true'}
 						>
 						>
 							<div class=" flex self-center flex-1 w-full">
 							<div class=" flex self-center flex-1 w-full">
 								<div
 								<div
@@ -398,6 +399,7 @@
 												editChatTitle(chat.id, chatTitle);
 												editChatTitle(chat.id, chatTitle);
 												chatTitleEditId = null;
 												chatTitleEditId = null;
 												chatTitle = '';
 												chatTitle = '';
+												isEditing = false;
 											}}
 											}}
 										>
 										>
 											<svg
 											<svg
@@ -485,7 +487,7 @@
 											on:click={() => {
 											on:click={() => {
 												chatTitle = chat.title;
 												chatTitle = chat.title;
 												chatTitleEditId = chat.id;
 												chatTitleEditId = chat.id;
-												// editChatTitle(chat.id, 'a');
+												isEditing = true;
 											}}
 											}}
 										>
 										>
 											<svg
 											<svg

+ 3 - 0
src/routes/(app)/+page.svelte

@@ -134,6 +134,9 @@
 		settings.set({
 		settings.set({
 			..._settings
 			..._settings
 		});
 		});
+
+		const chatInput = document.getElementById('chat-textarea');
+		setTimeout(() => chatInput?.focus(), 0);
 	};
 	};
 
 
 	const scrollToBottom = () => {
 	const scrollToBottom = () => {

+ 3 - 0
src/routes/(app)/c/[id]/+page.svelte

@@ -99,6 +99,9 @@
 			if (await loadChat()) {
 			if (await loadChat()) {
 				await tick();
 				await tick();
 				loaded = true;
 				loaded = true;
+
+				const chatInput = document.getElementById('chat-textarea');
+				chatInput?.focus();
 			} else {
 			} else {
 				await goto('/');
 				await goto('/');
 			}
 			}