Skip to content

Commit 8cf9af9

Browse files
authored
Merge pull request #2 from NativeMindBrowser/dev
Merge: merge dev into main (1.2.0)
2 parents 1e9cf69 + 9efdec4 commit 8cf9af9

39 files changed

+531
-659
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
release:
1919
name: Release ${{ inputs.releaseType }}
2020
runs-on: ubuntu-latest
21+
environment: release
2122
permissions:
2223
contents: write
2324
pull-requests: write

CHANGELOG.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,122 @@
11
# Changelog
22

33

4+
## v1.2.0-beta.13
5+
6+
[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.2.0-beta.12...v1.2.0-beta.13)
7+
8+
### 🩹 Fixes
9+
10+
- **translator:** Prevent connection attempt to Ollama when translation is disabled ([9b7943f](https://github.com/NativeMindBrowser/NativeMindExtension/commit/9b7943f))
11+
12+
### ❤️ Contributors
13+
14+
- Tony Hu ([@tonyhu-012](http://github.com/tonyhu-012))
15+
16+
## v1.2.0-beta.12
17+
18+
[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.2.0-beta.11...v1.2.0-beta.12)
19+
20+
### 🩹 Fixes
21+
22+
- **popup:** Show reload message in popup on unattached tabs ([3e4f0f8](https://github.com/NativeMindBrowser/NativeMindExtension/commit/3e4f0f8))
23+
24+
### ❤️ Contributors
25+
26+
- Tony Hu ([@tonyhu-012](http://github.com/tonyhu-012))
27+
28+
## v1.2.0-beta.11
29+
30+
[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.2.0-beta.10...v1.2.0-beta.11)
31+
32+
### 🚀 Enhancements
33+
34+
- **context-menu:** Refactor context menu items and update translation menu on tab activation ([d23dea6](https://github.com/NativeMindBrowser/NativeMindExtension/commit/d23dea6))
35+
36+
### ❤️ Contributors
37+
38+
- Tony Hu ([@tonyhu-012](http://github.com/tonyhu-012))
39+
40+
## v1.2.0-beta.10
41+
42+
[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.2.0-beta.9...v1.2.0-beta.10)
43+
44+
### 🚀 Enhancements
45+
46+
- **chat:** Send button style ([243eae7](https://github.com/NativeMindBrowser/NativeMindExtension/commit/243eae7))
47+
48+
### ❤️ Contributors
49+
50+
- Tony Hu ([@tonyhu-012](http://github.com/tonyhu-012))
51+
52+
## v1.2.0-beta.9
53+
54+
[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.2.0-beta.8...v1.2.0-beta.9)
55+
56+
### 🩹 Fixes
57+
58+
- Translation context menu ([9eb62a1](https://github.com/NativeMindBrowser/NativeMindExtension/commit/9eb62a1))
59+
60+
### ❤️ Contributors
61+
62+
- Tony Hu ([@tonyhu-012](http://github.com/tonyhu-012))
63+
64+
## v1.2.0-beta.8
65+
66+
[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.2.0-beta.7...v1.2.0-beta.8)
67+
68+
### 🏡 Chore
69+
70+
- **release:** Add environment specification for release job ([efc7e4d](https://github.com/NativeMindBrowser/NativeMindExtension/commit/efc7e4d))
71+
72+
### ❤️ Contributors
73+
74+
- Tony Hu ([@tonyhu-012](http://github.com/tonyhu-012))
75+
76+
## v1.2.0-beta.7
77+
78+
[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.2.0-beta.6...v1.2.0-beta.7)
79+
80+
### 🩹 Fixes
81+
82+
- Show settings if ollama not available when using translation ([9d1bcf5](https://github.com/NativeMindBrowser/NativeMindExtension/commit/9d1bcf5))
83+
84+
### ❤️ Contributors
85+
86+
- Tony Hu ([@tonyhu-012](http://github.com/tonyhu-012))
87+
88+
## v1.2.0-beta.6
89+
90+
[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.2.0-beta.5...v1.2.0-beta.6)
91+
92+
### 🚀 Enhancements
93+
94+
- **docs:** Add links to official website in README ([85dfca3](https://github.com/NativeMindBrowser/NativeMindExtension/commit/85dfca3))
95+
- **translator:** improve text content formatting in prompts and add skip target selector
96+
- **translator:** Some pages become unresponsive when using the translation ([7d60f69](https://github.com/NativeMindBrowser/NativeMindExtension/commit/7d60f69))
97+
98+
### 🩹 Fixes
99+
100+
- **readme:** Update demo screenshot ([944ae52](https://github.com/NativeMindBrowser/NativeMindExtension/commit/944ae52))
101+
102+
### ❤️ Contributors
103+
104+
- Tony Hu ([@tonyhu-012](http://github.com/tonyhu-012))
105+
- Xukecheng <[email protected]>
106+
107+
## v1.2.0-beta.5
108+
109+
[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.2.0-beta.4...v1.2.0-beta.5)
110+
111+
### 🚀 Enhancements
112+
113+
- **chat:** enhance send button positioning and styling in chat component chore
114+
- **i18n:** Update extension description for clarity and accuracy ([d49c3bc](https://github.com/NativeMindBrowser/NativeMindExtension/commit/d49c3bc))
115+
116+
### ❤️ Contributors
117+
118+
- Tony Hu ([@tonyhu-012](http://github.com/tonyhu-012))
119+
4120
## v1.2.0-beta.4
5121

6122
[compare changes](https://github.com/NativeMindBrowser/NativeMindExtension/compare/v1.2.0-beta.3...v1.2.0-beta.4)

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
*Experience powerful AI capabilities with zero cloud dependencies*
1010

11-
<img src="assets/images/demo-screenshot.jpg" alt="NativeMind in Action" width="800">
11+
<img src="assets/images/demo-screenshot.png" alt="NativeMind in Action" width="800">
1212

13+
### 🚀 [Visit Official Website](https://nativemind.app/)
1314

1415
[![Privacy First](https://img.shields.io/badge/Privacy-First-brightgreen?style=flat-square&logo=security&logoColor=white)]()
1516
[![No Tracking](https://img.shields.io/badge/Tracking-None-success?style=flat-square&logo=shield&logoColor=white)]()
@@ -45,6 +46,7 @@ Install directly from the [Chrome Web Store](https://chromewebstore.google.com/d
4546
<div align="center">
4647
<img src="assets/images/extension-popup.png" alt="NativeMind Extension Interface" width="600">
4748
<br>
49+
For more details, visit our official website: **[nativemind.app](https://nativemind.app/)**
4850
</div>
4951

5052
## ✨ Core Features

assets/images/demo-screenshot.jpg

-804 KB
Binary file not shown.

assets/images/demo-screenshot.png

850 KB
Loading

components/AutoExpandTextArea.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const emit = defineEmits<{
1919
2020
const props = defineProps<{
2121
modelValue?: string
22+
minHeight?: number
2223
}>()
2324
2425
const textareaRef = ref<HTMLTextAreaElement | null>(null)
@@ -30,11 +31,12 @@ watch(inputValue, async () => {
3031
await nextTick()
3132
const textarea = textareaRef.value as HTMLTextAreaElement
3233
if (!textarea) return
33-
textarea.style.height = 'auto' // Reset height to auto to shrink if needed
34+
textarea.style.height = '0px' // Reset height to auto to shrink if needed
3435
// force a reflow to ensure the height is recalculated
3536
const _ = textarea.offsetHeight
3637
const scrollHeight = textarea.scrollHeight
37-
textarea.style.height = `${scrollHeight}px` // Set height to scrollHeight to expand
38+
const height = Math.max(props.minHeight || 0, scrollHeight)
39+
textarea.style.height = `${height}px` // Set height to scrollHeight to expand
3840
})
3941
4042
const onInput = (event: Event) => {

components/ModelSelector.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ import IconDelete from '@/assets/icons/delete.svg?component'
8080
import ModelLogo from '@/components/ModelLogo.vue'
8181
import { useOllamaStatusStore } from '@/entrypoints/content/store'
8282
import { deleteOllamaModel } from '@/entrypoints/content/utils/llm'
83+
import { showSettings } from '@/entrypoints/content/utils/settings'
8384
import { formatSize } from '@/utils/formatter'
8485
import { SUPPORTED_MODELS } from '@/utils/llm/web-llm'
85-
import { getTabStore } from '@/utils/tab-store'
8686
import { getUserConfig } from '@/utils/user-config'
8787
import { classNames } from '@/utils/vue/utils'
8888
@@ -122,7 +122,6 @@ defineExpose({
122122
123123
const userConfig = await getUserConfig()
124124
const baseUrl = userConfig.llm.baseUrl.toRef()
125-
const tabStore = await getTabStore()
126125
const selectedModel = userConfig.llm.model.toRef()
127126
const endpointType = userConfig.llm.endpointType.toRef()
128127
@@ -142,16 +141,16 @@ const onClickDelete = async (model: string) => {
142141
143142
const onClick = () => {
144143
if (modelList.value.length === 0) {
145-
tabStore.showSetting.value = true
144+
showSettings(true, 'model-download-section')
146145
}
147146
}
148147
149148
watch(modelList, (modelList) => {
150149
if (modelList.length === 0) {
151-
selectedModel.value = ''
150+
selectedModel.value = undefined
152151
return
153152
}
154-
const newSelectedModel = modelList.find((m) => m.model === selectedModel.value) ?? modelList[0]
153+
const newSelectedModel = modelList.find((m) => m.model === selectedModel.value) ?? modelList[0] ?? undefined
155154
selectedModel.value = newSelectedModel.model
156155
})
157156

components/ScrollTarget.vue

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<template>
2+
<div
3+
ref="targetRef"
4+
:class="{
5+
'outline-2 outline-gray-600 outline-offset-4 outline-dashed rounded-md': highlighting,
6+
}"
7+
>
8+
<slot />
9+
</div>
10+
</template>
11+
12+
<script setup lang="ts">
13+
import { onMounted, ref } from 'vue'
14+
15+
const props = defineProps<{
16+
autoScrollIntoView?: boolean
17+
scrollIntoViewOptions?: ScrollIntoViewOptions
18+
showHighlight?: boolean
19+
}>()
20+
21+
const targetRef = ref<HTMLDivElement>()
22+
const highlighting = ref(false)
23+
24+
const scrollIntoView = () => {
25+
targetRef.value?.scrollIntoView({
26+
behavior: 'smooth',
27+
block: 'start',
28+
inline: 'start',
29+
...props.scrollIntoViewOptions,
30+
})
31+
}
32+
33+
const highlight = () => {
34+
if (!props.showHighlight) return
35+
highlighting.value = true
36+
setTimeout(() => {
37+
highlighting.value = false
38+
}, 3000)
39+
}
40+
41+
onMounted(() => {
42+
if (!targetRef.value) return
43+
if (props.autoScrollIntoView) {
44+
scrollIntoView()
45+
highlight()
46+
}
47+
})
48+
</script>

components/ToastGroup.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<div
33
v-if="toasts.length"
44
data-nativemind-toast-group
5-
class="fixed left-0 top-0 right-0 flex flex-col items-center gap-2 p-4 z-50"
5+
class="fixed left-0 top-0 right-0 flex flex-col items-center gap-2 p-4 z-[calc(infinity-1)]"
66
>
77
<div
88
v-for="toast in toasts"
99
:key="toast.id"
10-
class="max-w-80 bg-white shadow-md rounded-md p-3 transition-all duration-300 text-xs flex items-center gap-2 justify-between"
10+
class="max-w-80 bg-white text-black shadow-md rounded-md p-3 transition-all duration-300 text-xs flex items-center gap-2 justify-between"
1111
>
1212
<div class="flex items-center gap-2">
1313
<div>

entrypoints/background.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { browser } from 'wxt/browser'
55
import { defineBackground } from 'wxt/utils/define-background'
66

77
import { INVALID_URLS } from '@/utils/constants'
8-
import { CONTEXT_MENU } from '@/utils/context-menu'
8+
import { CONTEXT_MENU, CONTEXT_MENU_ITEM_TRANSLATE_PAGE } from '@/utils/context-menu'
99
import logger from '@/utils/logger'
1010
import { bgBroadcastRpc } from '@/utils/rpc'
11+
import { registerBackgroundRpcEvent } from '@/utils/rpc/background-fns'
1112
import { isTabValid } from '@/utils/tab'
1213
import { registerDeclarativeNetRequestRule } from '@/utils/web-request'
1314

@@ -50,6 +51,11 @@ export default defineBackground(() => {
5051
}
5152

5253
browser.tabs.onActivated.addListener(async ({ tabId }) => {
54+
// reset the translate context menu to default
55+
await browser.contextMenus.update(CONTEXT_MENU_ITEM_TRANSLATE_PAGE.id, {
56+
title: CONTEXT_MENU_ITEM_TRANSLATE_PAGE.title,
57+
contexts: CONTEXT_MENU_ITEM_TRANSLATE_PAGE.contexts,
58+
})
5359
const tab = await browser.tabs.get(tabId)
5460
const url = tab.url
5561
url && (await setPopupStatusBasedOnUrl(tabId, url))
@@ -64,9 +70,8 @@ export default defineBackground(() => {
6470
})
6571
})
6672

67-
browser.tabs.onUpdated.addListener(async (tabId, _changeInfo, tab) => {
68-
logger.info('tab updated', { tabId, changeInfo: _changeInfo, tab })
69-
unAttachedTabs.delete(tabId)
73+
browser.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
74+
logger.info('tab updated', { tabId, changeInfo, tab })
7075
if (tab.url) {
7176
await setPopupStatusBasedOnUrl(tabId, tab.url)
7277
}
@@ -107,5 +112,9 @@ export default defineBackground(() => {
107112
}
108113
})
109114

115+
registerBackgroundRpcEvent('ready', (tabId) => {
116+
unAttachedTabs.delete(tabId)
117+
})
118+
110119
logger.info('Hello background!', { id: browser.runtime.id })
111120
})

0 commit comments

Comments
 (0)