Update package version and add hideEditAndRegenerate prop

This commit is contained in:
n4ze3m 2024-03-16 14:28:32 +05:30
parent 78c44e13b0
commit 4aff7f991a
4 changed files with 32 additions and 18 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "pageassist", "name": "pageassist",
"displayName": "Page Assist - A Web UI for Local AI Models", "displayName": "Page Assist - A Web UI for Local AI Models",
"version": "1.0.8", "version": "1.0.9",
"description": "Use your locally running AI models to assist you in your web browsing.", "description": "Use your locally running AI models to assist you in your web browsing.",
"author": "n4ze3m", "author": "n4ze3m",
"scripts": { "scripts": {

View File

@ -21,6 +21,7 @@ type Props = {
webSearch?: {} webSearch?: {}
isSearchingInternet?: boolean isSearchingInternet?: boolean
sources?: any[] sources?: any[]
hideEditAndRegenerate?: boolean
} }
export const PlaygroundMessage = (props: Props) => { export const PlaygroundMessage = (props: Props) => {
@ -130,7 +131,8 @@ export const PlaygroundMessage = (props: Props) => {
</Tooltip> </Tooltip>
)} )}
{props.currentMessageIndex === props.totalMessages - 1 && ( {!props.hideEditAndRegenerate &&
props.currentMessageIndex === props.totalMessages - 1 && (
<Tooltip title="Regenerate"> <Tooltip title="Regenerate">
<button <button
onClick={props.onRengerate} onClick={props.onRengerate}
@ -141,6 +143,7 @@ export const PlaygroundMessage = (props: Props) => {
)} )}
</> </>
)} )}
{!props.hideEditAndRegenerate && (
<Tooltip title="Edit"> <Tooltip title="Edit">
<button <button
onClick={() => setEditMode(true)} onClick={() => setEditMode(true)}
@ -148,6 +151,7 @@ export const PlaygroundMessage = (props: Props) => {
<Pen className="w-3 h-3 text-gray-400 group-hover:text-gray-500" /> <Pen className="w-3 h-3 text-gray-400 group-hover:text-gray-500" />
</button> </button>
</Tooltip> </Tooltip>
)}
</div> </div>
)} )}
</div> </div>

View File

@ -26,6 +26,7 @@ export const SidePanelBody = () => {
totalMessages={messages.length} totalMessages={messages.length}
onRengerate={() => {}} onRengerate={() => {}}
isProcessing={streaming} isProcessing={streaming}
hideEditAndRegenerate
/> />
))} ))}
<div className="w-full h-32 md:h-48 flex-shrink-0"></div> <div className="w-full h-32 md:h-48 flex-shrink-0"></div>

View File

@ -1,6 +1,15 @@
import { getWebSearchPrompt } from "~services/ollama" import { getWebSearchPrompt } from "~services/ollama"
import { webSearch } from "./local-google" import { webSearch } from "./local-google"
const getHostName = (url: string) => {
try {
const hostname = new URL(url).hostname
return hostname
} catch (e) {
return ""
}
}
export const getSystemPromptForWeb = async (query: string) => { export const getSystemPromptForWeb = async (query: string) => {
try { try {
const search = await webSearch(query) const search = await webSearch(query)
@ -18,7 +27,7 @@ export const getSystemPromptForWeb = async (query: string) => {
source: search.map((result) => { source: search.map((result) => {
return { return {
url: result.url, url: result.url,
name: new URL(result.url).hostname, name: getHostName(result.url),
type: "url", type: "url",
} }
}) })