mirror of
https://github.com/open-webui/computer.git
synced 2026-11-26 23:29:25 -05:00
10 files changed
+143
-14
No files matched your search
@@ -109,7 +109,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
environment: pypi
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Download dist artifacts
|
||||
@@ -118,18 +117,25 @@ jobs:
|
||||
name: dist
|
||||
path: dist/
|
||||
|
||||
- name: Publish to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
# No API token needed - uses OIDC trusted publishing.
|
||||
# Configure at: https://pypi.org/manage/project/cptr/settings/publishing/
|
||||
|
||||
github-release-assets:
|
||||
needs: build
|
||||
if: needs.build.outputs.skip != 'true'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Download release artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: release-assets
|
||||
path: release-assets/
|
||||
|
||||
- name: Publish to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
# No API token needed - uses OIDC trusted publishing.
|
||||
# Configure at: https://pypi.org/manage/project/cptr/settings/publishing/
|
||||
|
||||
- name: Upload GitHub release artifacts
|
||||
- name: Attach GitHub release artifacts
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VERSION: ${{ needs.build.outputs.version }}
|
||||
|
||||
@@ -5,6 +5,12 @@ 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/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.7.7] - 2026-07-06
|
||||
|
||||
### Added
|
||||
|
||||
- 🔍 **SearXNG web search.** Choose SearXNG in Web settings and connect Computer to your own search instance.
|
||||
|
||||
## [0.7.6] - 2026-07-06
|
||||
|
||||
### Added
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
let perplexityBaseUrl = $state('');
|
||||
let firecrawlSearchKey = $state('');
|
||||
let firecrawlSearchBaseUrl = $state('https://api.firecrawl.dev');
|
||||
let searxngBaseUrl = $state('');
|
||||
let ccKey = $state('');
|
||||
let ccBaseUrl = $state('');
|
||||
let ccModel = $state('');
|
||||
@@ -51,6 +52,7 @@
|
||||
firecrawlSearchKey = (config['web.firecrawl_api_key'] as string) || '';
|
||||
firecrawlSearchBaseUrl =
|
||||
(config['web.firecrawl_base_url'] as string) || 'https://api.firecrawl.dev';
|
||||
searxngBaseUrl = (config['web.searxng_base_url'] as string) || '';
|
||||
ccKey = (config['web.chat_completions_api_key'] as string) || '';
|
||||
ccBaseUrl = (config['web.chat_completions_base_url'] as string) || '';
|
||||
ccModel = (config['web.chat_completions_model'] as string) || '';
|
||||
@@ -87,6 +89,7 @@
|
||||
'web.perplexity_base_url': perplexityBaseUrl,
|
||||
'web.firecrawl_api_key': firecrawlSearchKey,
|
||||
'web.firecrawl_base_url': firecrawlSearchBaseUrl,
|
||||
'web.searxng_base_url': searxngBaseUrl,
|
||||
'web.chat_completions_api_key': ccKey,
|
||||
'web.chat_completions_base_url': ccBaseUrl,
|
||||
'web.chat_completions_model': ccModel,
|
||||
@@ -165,6 +168,7 @@
|
||||
<option value="tavily">Tavily</option>
|
||||
<option value="brave">Brave</option>
|
||||
<option value="firecrawl">{$t('admin.browserFirecrawl')}</option>
|
||||
<option value="searxng">SearXNG</option>
|
||||
<option value="perplexity">Perplexity</option>
|
||||
<option value="duckduckgo">DuckDuckGo</option>
|
||||
<option value="chat_completions">{$t('admin.webChatCompletions')}</option>
|
||||
@@ -257,6 +261,22 @@
|
||||
{$t('admin.browserFirecrawlBaseUrlHint')}
|
||||
</p>
|
||||
</div>
|
||||
{:else if searchProvider === 'searxng'}
|
||||
<div>
|
||||
<label class="text-xs text-gray-600 dark:text-gray-400" for="searxng-base-url"
|
||||
>{$t('admin.webSearxngBaseUrl')}</label
|
||||
>
|
||||
<input
|
||||
id="searxng-base-url"
|
||||
type="text"
|
||||
bind:value={searxngBaseUrl}
|
||||
placeholder="https://search.example.com"
|
||||
class="w-full mt-1 h-7 px-2 rounded-lg text-xs bg-gray-100 dark:bg-white/6 text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-white/8 outline-none focus:border-blue-400 dark:focus:border-blue-500 transition-colors"
|
||||
/>
|
||||
<p class="text-[0.6875rem] text-gray-400 dark:text-gray-600 mt-0.5">
|
||||
{$t('admin.webSearxngHint')}
|
||||
</p>
|
||||
</div>
|
||||
{:else if searchProvider === 'perplexity'}
|
||||
<div>
|
||||
<label class="text-xs text-gray-600 dark:text-gray-400" for="pplx-key"
|
||||
|
||||
@@ -367,7 +367,7 @@
|
||||
>
|
||||
<a
|
||||
href="/?workspace={encodeURIComponent(ws.path)}"
|
||||
class="flex items-center gap-1 flex-1 min-w-0 no-underline text-inherit"
|
||||
class="flex items-center gap-1.5 flex-1 min-w-0 no-underline text-inherit"
|
||||
onclick={(e) => handleWorkspaceClick(e, ws.path)}
|
||||
>
|
||||
<!-- Icon: folder by default, chevron on hover (when chat enabled) -->
|
||||
@@ -661,7 +661,7 @@
|
||||
}
|
||||
|
||||
.ws-chats {
|
||||
padding-left: 0.25rem;
|
||||
margin-top: 0.125rem;
|
||||
padding-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="flex items-center gap-1.5 w-full h-7 px-2 rounded-md cursor-pointer transition-colors duration-75
|
||||
hover:bg-gray-50 dark:hover:bg-white/3"
|
||||
class="flex items-center gap-1.5 w-full h-7 px-2 rounded-lg cursor-pointer transition-colors duration-75
|
||||
hover:bg-gray-50/50 dark:hover:bg-white/[0.02]"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
{onclick}
|
||||
|
||||
@@ -338,6 +338,8 @@
|
||||
"admin.webFirecrawlKey": "Firecrawl API Key",
|
||||
"admin.webFirecrawlBaseUrl": "Firecrawl Base URL",
|
||||
"admin.webFirecrawlHint": "Uses Firecrawl search. Leave base URL as-is unless you self-host Firecrawl.",
|
||||
"admin.webSearxngBaseUrl": "SearXNG Base URL",
|
||||
"admin.webSearxngHint": "Use a SearXNG instance with JSON output enabled.",
|
||||
"admin.webDuckDuckGoNote": "DuckDuckGo requires no API key (fallback).",
|
||||
"admin.webPerplexityKey": "Perplexity API Key",
|
||||
"admin.webPerplexityHint": "Get your API key at perplexity.ai",
|
||||
|
||||
@@ -6,7 +6,8 @@ Priority in auto mode:
|
||||
3. Tavily (TAVILY_API_KEY or web.tavily_api_key)
|
||||
4. Brave (BRAVE_API_KEY or web.brave_api_key)
|
||||
5. Firecrawl (FIRECRAWL_API_KEY or web.firecrawl_api_key)
|
||||
6. DuckDuckGo (zero-config fallback)
|
||||
6. SearXNG (SEARXNG_BASE_URL or web.searxng_base_url)
|
||||
7. DuckDuckGo (zero-config fallback)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -50,6 +51,7 @@ async def web_search_handler(query: str) -> str:
|
||||
duckduckgo,
|
||||
chat_completions,
|
||||
firecrawl,
|
||||
searxng,
|
||||
)
|
||||
|
||||
# Check if web access is disabled by admin
|
||||
@@ -74,6 +76,9 @@ async def web_search_handler(query: str) -> str:
|
||||
)
|
||||
if not firecrawl_url:
|
||||
firecrawl_url = await _get_config("browser.firecrawl_base_url")
|
||||
searxng_url = (await _get_config("web.searxng_base_url")) or os.environ.get(
|
||||
"SEARXNG_BASE_URL", ""
|
||||
)
|
||||
cc_key = await _get_key("CHAT_COMPLETIONS_SEARCH_API_KEY", "web.chat_completions_api_key")
|
||||
cc_url = (await _get_config("web.chat_completions_base_url")) or os.environ.get(
|
||||
"CHAT_COMPLETIONS_SEARCH_BASE_URL", ""
|
||||
@@ -111,6 +116,10 @@ async def web_search_handler(query: str) -> str:
|
||||
if firecrawl_url:
|
||||
return await firecrawl.search(query, firecrawl_key, base_url=firecrawl_url)
|
||||
return await firecrawl.search(query, firecrawl_key)
|
||||
elif provider == "searxng":
|
||||
if not searxng_url:
|
||||
return "Error: SearXNG base URL not configured."
|
||||
return await searxng.search(query, searxng_url)
|
||||
elif provider == "duckduckgo":
|
||||
return await duckduckgo.search(query)
|
||||
elif provider == "chat_completions":
|
||||
@@ -139,6 +148,8 @@ async def web_search_handler(query: str) -> str:
|
||||
if firecrawl_key:
|
||||
_fc_kw = {"base_url": firecrawl_url} if firecrawl_url else {}
|
||||
providers.append(("firecrawl", lambda: firecrawl.search(query, firecrawl_key, **_fc_kw)))
|
||||
if searxng_url:
|
||||
providers.append(("searxng", lambda: searxng.search(query, searxng_url)))
|
||||
providers.append(("duckduckgo", lambda: duckduckgo.search(query)))
|
||||
|
||||
for name, fn in providers:
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
"""SearXNG search provider.
|
||||
|
||||
https://docs.searxng.org/dev/search_api.html
|
||||
Queries a configured SearXNG instance's JSON API.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import httpx
|
||||
|
||||
|
||||
def _text(value: object) -> str:
|
||||
if value is None:
|
||||
return ""
|
||||
if isinstance(value, str):
|
||||
return value.strip()
|
||||
return str(value).strip()
|
||||
|
||||
|
||||
def _score(item: dict[str, object]) -> float:
|
||||
try:
|
||||
return float(item.get("score") or 0)
|
||||
except (TypeError, ValueError):
|
||||
return 0
|
||||
|
||||
|
||||
async def search(query: str, base_url: str, count: int = 5) -> str:
|
||||
"""Search using a self-hosted SearXNG instance."""
|
||||
async with httpx.AsyncClient(timeout=15, follow_redirects=True) as client:
|
||||
resp = await client.get(
|
||||
f"{base_url.rstrip('/')}/search",
|
||||
params={"q": query, "format": "json"},
|
||||
headers={"User-Agent": "Mozilla/5.0 (compatible; cptr/1.0)"},
|
||||
)
|
||||
resp.raise_for_status()
|
||||
data = resp.json()
|
||||
|
||||
parts = []
|
||||
|
||||
for answer in data.get("answers") or []:
|
||||
answer_text = _text(answer)
|
||||
if answer_text:
|
||||
parts.append(f"> {answer_text}")
|
||||
|
||||
for box in (data.get("infoboxes") or [])[:count]:
|
||||
title = _text(box.get("infobox") or box.get("title"))
|
||||
content = _text(box.get("content"))
|
||||
attributes = []
|
||||
for attr in box.get("attributes") or []:
|
||||
label = _text(attr.get("label"))
|
||||
value = _text(attr.get("value"))
|
||||
if label and value:
|
||||
attributes.append(f"{label}: {value}")
|
||||
|
||||
box_parts = []
|
||||
if title:
|
||||
box_parts.append(f"**Infobox - {title}**")
|
||||
if content:
|
||||
box_parts.append(content)
|
||||
box_parts.extend(attributes)
|
||||
if box_parts:
|
||||
parts.append("\n".join(box_parts))
|
||||
|
||||
results = sorted(data.get("results") or [], key=_score, reverse=True)
|
||||
for item in results[:count]:
|
||||
title = _text(item.get("title"))
|
||||
url = _text(item.get("url"))
|
||||
content = _text(item.get("content"))
|
||||
result_parts = []
|
||||
if title:
|
||||
result_parts.append(f"**{title}**")
|
||||
if url:
|
||||
result_parts.append(url)
|
||||
if content:
|
||||
result_parts.append(content)
|
||||
if result_parts:
|
||||
parts.append("\n".join(result_parts))
|
||||
|
||||
suggestions = [_text(item) for item in data.get("suggestions") or []]
|
||||
suggestions = [item for item in suggestions if item]
|
||||
if suggestions:
|
||||
parts.append(f"Suggestions: {', '.join(suggestions)}")
|
||||
|
||||
return "\n\n".join(parts) if parts else "No results found."
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "cptr"
|
||||
version = "0.7.6"
|
||||
version = "0.7.7"
|
||||
description = "Your computer, from anywhere. Code, manage, and control your machine from the web."
|
||||
license = {file = "LICENSE"}
|
||||
readme = "README.md"
|
||||
|
||||
Reference in new issue
Block a user