Skip to content

Commit

Permalink
Merge pull request #64 from n4ze3m/next
Browse files Browse the repository at this point in the history
v1.1.7
  • Loading branch information
n4ze3m authored May 13, 2024
2 parents b982ce1 + 8f8fac8 commit a4a684f
Show file tree
Hide file tree
Showing 56 changed files with 782 additions and 242 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@ keys.json

# typescript
.tsbuildinfo
.wxt
# WXT
.wxt
# WebStorm
.idea
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ Note: You can install the extension on any Chromium-based browser. It is not lim

### Manual Installation

#### Pre-requisites

- Node.js (v18 or higher) - [Installation Guide](https://nodejs.org)
- npm
- Ollama (Local AI Provider) - [Installation Guide](https://ollama.com)


1. Clone the repository

```bash
Expand All @@ -43,20 +50,33 @@ cd page-assist
npm install
```

3. Build the extension
3. Build the extension (by default it will build for Chrome)

```bash
npm run build
```

4. Load the extension
or you can build for Firefox

```bash
npm run build:firefox
```

4. Load the extension (chrome)

- Open the Extension Management page by navigating to `chrome://extensions`.

- Enable Developer Mode by clicking the toggle switch next to Developer mode.

- Click the `Load unpacked` button and select the `build` directory.

5. Load the extension (firefox)

- Open the Add-ons page by navigating to `about:addons`.
- Click the `Extensions` tab.
- Click the `Manage Your Extensions` button.
- Click the `Load Temporary Add-on` button and select the `manifest.json` file from the `build` directory.

## Usage

### Sidebar
Expand Down Expand Up @@ -89,18 +109,18 @@ This will start a development server and watch for changes in the source files.
| -------- | ------- | ----------------- | ------ |
| Chrome ||||
| Brave ||||
| Firefox ||||
| Edge ||||
| Opera GX ||||
| Arc ||||
| Firefox ||||

## Local AI Provider

- [Ollama](https://github.com/ollama/ollama) (Currently the only supported provider. More providers will be added in the future.)

## Roadmap

- [ ] Firefox Support
- [X] Firefox Support
- [ ] More Local AI Providers
- [ ] More Features
- [ ] More Customization Options
Expand Down
Binary file modified bun.lockb
Binary file not shown.
33 changes: 33 additions & 0 deletions docs/connection-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Ollama Connection Issues

Connection issues can be caused by a number of reasons. Here are some common issues and how to resolve them on Page Assist. You will see the following error message if there is a connection issue:

### 1. Direct Connection Error
![Direct connection error](https://image.pageassist.xyz/Screenshot%202024-05-13%20001742.png)

### 2. `403` Error When Sending a Message
![403 error when sending a message](https://image.pageassist.xyz/Screenshot%202024-05-13%20001940.png)

This issue usually occurs when Ollama is not running on [http://127.0.0.1:11434/](http://127.0.0.1:11434/), and the connection is from the private network or a different network.

### Solutions

Since Ollama has connection issues when directly accessed from the browser extension, Page Assist rewrites the request headers to make it work. However, automatic rewriting of headers only works on `http://127.0.0.1:*` and `http://localhost:*` URLs. To resolve the connection issue, you can try the following solutions:

1. Go to Page Assist and click on the `Settings` icon.

2. Click on the `Ollama Settings` tab.

3. There you will see the `Advance Ollama URL Configuration` option. You need to expand it.

![Advance Ollama URL Configuration](https://image.pageassist.xyz/Screenshot%202024-05-13%20003123.png)

4. Enable the `Enable or Disable Custom Origin URL` option.

![Enable or Disable Custom Origin URL](https://image.pageassist.xyz/Screenshot%202024-05-13%20003225.png)

5. (Optional) If Ollama is running on a different port or host, then change the URL in the `Custom Origin URL` field; otherwise, leave it as it is.

This will resolve the connection issue, and you will be able to use Ollama without any issues on Page Assist ❤

If you still face any issues, feel free to contact us [here](https://github.com/n4ze3m/page-assist/issues/new), and we will be happy to help you out.
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"description": "Use your locally running AI models to assist you in your web browsing.",
"author": "n4ze3m",
"scripts": {
"dev": "wxt",
"dev:firefox": "wxt -b firefox",
"build": "wxt build",
"build:firefox": "wxt build -b firefox",
"zip": "wxt zip",
"zip:firefox": "wxt zip -b firefox",
"dev": "cross-env TARGET=chrome wxt",
"dev:firefox": "cross-env TARGET=firefox wxt -b firefox",
"build": "cross-env TARGET=chrome wxt build",
"build:firefox": "cross-env TARGET=chrome cross-env TARGET=firefox wxt build -b firefox",
"zip": "cross-env TARGET=chrome wxt zip",
"zip:firefox": "cross-env TARGET=firefox wxt zip -b firefox",
"compile": "tsc --noEmit",
"postinstall": "wxt prepare"
},
Expand Down Expand Up @@ -66,6 +66,7 @@
"@types/react-syntax-highlighter": "^15.5.11",
"@types/turndown": "^5.0.4",
"autoprefixer": "^10.4.17",
"cross-env": "^7.0.3",
"postcss": "^8.4.33",
"prettier": "3.2.4",
"tailwindcss": "^3.4.1",
Expand Down
2 changes: 1 addition & 1 deletion page-share.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Click the button below to deploy the code to Railway.

```bash
git clone https://github.com/n4ze3m/page-share-app.git
cd page-assist-app
cd page-share-app
```

2. Run the server
Expand Down
3 changes: 2 additions & 1 deletion src/assets/locale/en/playground.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"ollamaState": {
"searching": "Searching for Your Ollama 🦙",
"running": "Ollama is running 🦙",
"notRunning": "Unable to connect to Ollama 🦙"
"notRunning": "Unable to connect to Ollama 🦙",
"connectionError": "It seems like you are having a connection error. Please refer to this <anchor>documentation</anchor> for troubleshooting."
},
"formError": {
"noModel": "Please select a model",
Expand Down
11 changes: 11 additions & 0 deletions src/assets/locale/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,17 @@
"webSearchFollowUpPromptHelp": "Do not remove `{chat_history}` and `{question}` from the prompt.",
"webSearchFollowUpPromptError": "Please input your Web Search Follow Up Prompt!",
"webSearchFollowUpPromptPlaceholder": "Your Web Search Follow Up Prompt"
},
"advanced": {
"label": "Advance Ollama URL Configuration",
"urlRewriteEnabled": {
"label": "Enable or Disable Custom Origin URL"
},
"rewriteUrl": {
"label": "Custom Origin URL",
"placeholder": "Enter Custom Origin URL"
},
"help": "If you have connection issues with Ollama on Page Assist, you can configure a custom origin URL. To learn more about the configuration, <anchor>click here</anchor>."
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/assets/locale/ja-JP/playground.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"ollamaState": {
"searching": "Ollamaを検索中 🦙",
"running": "Ollamaが実行中 🦙",
"notRunning": "Ollamaに接続できません 🦙"
"notRunning": "Ollamaに接続できません 🦙",
"connectionError": "接続エラーが発生しているようです。トラブルシューティングについては<anchor>ドキュメント</anchor>をご覧ください。"
},
"formError": {
"noModel": "モデルを選択してください",
Expand Down
11 changes: 11 additions & 0 deletions src/assets/locale/ja-JP/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,17 @@
"webSearchFollowUpPromptHelp": "プロンプトから`{chat_history}`と`{question}`を削除しないでください。",
"webSearchFollowUpPromptError": "Web検索フォローアッププロンプトを入力してください!",
"webSearchFollowUpPromptPlaceholder": "Web検索フォローアッププロンプト"
},
"advanced": {
"label": "Ollama URL の高度な設定",
"urlRewriteEnabled": {
"label": "カスタムOriginのURLを有効化または無効化する"
},
"rewriteUrl": {
"label": "カスタムOriginのURL",
"placeholder": "カスタムOriginのURLを入力"
},
"help": "PageAssistでOllamaに接続の問題がある場合は、カスタムOriginのURLを設定できます。設定の詳細については、<anchor>ここをクリック</anchor>してください。"
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/assets/locale/ml/playground.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"ollamaState": {
"searching": "നിങ്ങളുടെ ഒല്ലാമയ്ക്കായി തിരയുന്നു 🦙",
"running": "ഒല്ലാമ പ്രവര്‍ത്തിക്കുന്നു 🦙",
"notRunning": "ഒല്ലാമയുമായി ബന്ധിപ്പിക്കാന്‍ കഴിയുന്നില്ല 🦙"
"notRunning": "ഒല്ലാമയുമായി ബന്ധിപ്പിക്കാന്‍ കഴിയുന്നില്ല 🦙",
"connectionError": "നിങ്ങൾക്ക് കണക്ഷൻ പ്രശ്നം ഉണ്ടെന്നു കാണുന്നു. ഈ <anchor>ഡോക്യുമെന്റേഷൻ</anchor> പരിശോധിക്കാൻ കൂടുതൽ സഹായത്തിനായി."
},
"formError": {
"noModel": "ദയവായി ഒരു മോഡല്‍ തിരഞ്ഞെടുക്കുക",
Expand Down
17 changes: 14 additions & 3 deletions src/assets/locale/ml/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@
"label": "ചാറ്റ് ചരിത്രം, അറിവ് അടിസ്ഥാനം, പ്രോംപ്റ്റുകൾ എക്സ്പോർട്ട് ചെയ്യുക",
"button": "ഡാറ്റ എക്സ്പോർട്ട് ചെയ്യുക",
"success": "എക്സ്പോർട്ട് വിജയകരമായി"
},
"import": {
},
"import": {
"label": "ചാറ്റ് ചരിത്രം, അറിവ് അടിസ്ഥാനം, പ്രോംപ്റ്റുകൾ ഇമ്പോർട്ട് ചെയ്യുക",
"button": "ഡാറ്റ ഇമ്പോർട്ട് ചെയ്യുക",
"success": "ഇമ്പോർട്ട് വിജയകരമായി",
"error": "ഇമ്പോർട്ട് പിശക്"
}
}
},
"tts": {
"heading": "ടെക്സ്റ്റ്-ടു-സ്പീച്ച് ക്രമീകരണങ്ങൾ",
Expand Down Expand Up @@ -248,6 +248,17 @@
"webSearchFollowUpPromptHelp": "പ്രോംപ്റ്റില്‍ നിന്ന് `{chat_history}` യും `{question}` യും നീക്കം ചെയ്യരുത്.",
"webSearchFollowUpPromptError": "ദയവായി നിങ്ങളുടെ വെബ് തിരയല്‍ തുടര്‍പ്രോംപ്റ്റ് നല്കുക!",
"webSearchFollowUpPromptPlaceholder": "നിങ്ങളുടെ വെബ് തിരയല്‍ തുടര്‍പ്രോംപ്റ്റ്"
},
"advanced": {
"label": "Advance Ollama URL Configuration",
"urlRewriteEnabled": {
"label": "Enable or Disable Custom Origin URL"
},
"rewriteUrl": {
"label": "Custom Origin URL",
"placeholder": "Enter Custom Origin URL"
},
"help": "ഏജ് അസിസ്റ്റന്റിൽ Ollama-യുമായി ബന്ധപ്പെടുമ്പോൾ ബന്ധതടസ്സം ഉണ്ടെങ്കിൽ, നിങ്ങൾക്ക് ഒരു വ്യക്തിഗത അസ്ഥിരത്വം URL കോൺഫിഗർ ചെയ്യാം. കോൺഫിഗറേഷനെക്കുറിച്ച് കൂടുതലറിയാൻ, <anchor>ഇവിടെ ക്ലിക്കുചെയ്യുക</anchor>."
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/assets/locale/ru/playground.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"ollamaState": {
"searching": "Поиск вашего Ollama 🦙",
"running": "Ollama работает 🦙",
"notRunning": "Не удалось подключиться к Ollama 🦙"
"notRunning": "Не удалось подключиться к Ollama 🦙",
"connectionError": "Похоже, у вас возникла ошибка соединения. Пожалуйста, обратитесь к этой <anchor>документации</anchor> для устранения неисправностей."
},
"formError": {
"noModel": "Пожалуйста, выберите модель",
Expand Down
11 changes: 11 additions & 0 deletions src/assets/locale/ru/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,17 @@
"webSearchFollowUpPromptHelp": "Не удаляйте `{chat_history}` и `{question}` из подсказки.",
"webSearchFollowUpPromptError": "Введите подсказку для последующего веб-поиска!",
"webSearchFollowUpPromptPlaceholder": "Ваша подсказка для последующего веб-поиска"
},
"advanced": {
"label": "Расширенная конфигурация URL Ollama",
"urlRewriteEnabled": {
"label": "Включить или отключить пользовательский исходный URL"
},
"rewriteUrl": {
"label": "Пользовательский исходный URL",
"placeholder": "Введите пользовательский исходный URL"
},
"help": "Если у вас возникают проблемы с подключением к Ollama на странице помощника, вы можете настроить пользовательский исходный URL. Чтобы узнать больше о конфигурации, <anchor>нажмите здесь</anchor>."
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/assets/locale/zh/playground.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"ollamaState": {
"searching": "正在搜索您的Ollama 🦙",
"running": "Ollama正在运行 🦙",
"notRunning": "无法连接到Ollama 🦙"
"notRunning": "无法连接到Ollama 🦙",
"connectionError": "看起来你正在遇到连接错误。请参阅这<anchor>文档</anchor>进行故障排除。"
},
"formError": {
"noModel": "请选择一个模型",
Expand Down
11 changes: 11 additions & 0 deletions src/assets/locale/zh/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,17 @@
"webSearchFollowUpPromptHelp": "请勿从提示词中删除 `{chat_history}` 和 `{question}`。",
"webSearchFollowUpPromptError": "请输入您的网页搜索追问提示词!",
"webSearchFollowUpPromptPlaceholder": "您的网页搜索追问提示词"
},
"advanced": {
"label": "Ollama URL 高级配置",
"urlRewriteEnabled": {
"label": "启用或禁用自定义来源 URL"
},
"rewriteUrl": {
"label": "自定义来源 URL",
"placeholder": "输入自定义来源 URL"
},
"help": "如果您在 Page Assist 上与 Ollama 有连接问题,您可以配置自定义来源 URL。要了解更多关于配置的信息,<anchor>点击此处</anchor>。"
}
}
},
Expand Down
49 changes: 49 additions & 0 deletions src/components/Common/AdvanceOllamaSettings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { useStorage } from "@plasmohq/storage/hook"
import { Input, Switch } from "antd"
import { useTranslation } from "react-i18next"

export const AdvanceOllamaSettings = () => {
const [urlRewriteEnabled, setUrlRewriteEnabled] = useStorage(
"urlRewriteEnabled",
false
)

const [rewriteUrl, setRewriteUrl] = useStorage(
"rewriteUrl",
"http://127.0.0.1:11434"
)
const { t } = useTranslation("settings")

return (
<div className="space-y-4">
<div className="flex sm:flex-row flex-col space-y-4 sm:space-y-0 sm:justify-between">
<span className="text-gray-500 dark:text-neutral-50 ">
{t("ollamaSettings.settings.advanced.urlRewriteEnabled.label")}
</span>
<div>
<Switch
className="mt-4 sm:mt-0"
checked={urlRewriteEnabled}
onChange={(checked) => setUrlRewriteEnabled(checked)}
/>
</div>
</div>
<div className="flex flex-col space-y-4 sm:space-y-0 sm:justify-between">
<span className="text-gray-500 dark:text-neutral-50 mb-3">
{t("ollamaSettings.settings.advanced.rewriteUrl.label")}
</span>
<div>
<Input
className="w-full"
value={rewriteUrl}
disabled={!urlRewriteEnabled}
placeholder={t(
"ollamaSettings.settings.advanced.rewriteUrl.placeholder"
)}
onChange={(e) => setRewriteUrl(e.target.value)}
/>
</div>
</div>
</div>
)
}
10 changes: 10 additions & 0 deletions src/components/Common/PageAssistLoader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

export const PageAssistLoader = () => {
return (
<div className="fixed bg-[#171717] top-0 left-0 right-0 bottom-0 w-full h-screen z-50 overflow-hidden opacity-75 flex flex-col items-center justify-center">
<p className="text-center text-white text-lg mt-4">
Loading...
</p>
</div>
)
}
2 changes: 1 addition & 1 deletion src/components/Option/Models/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const ModelsBody = () => {

form.reset()

chrome.runtime.sendMessage({
browser.runtime.sendMessage({
type: "pull_model",
modelName
})
Expand Down
Loading

0 comments on commit a4a684f

Please sign in to comment.