nuxt-ollama 1.1.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -2
- package/dist/module.d.mts +4 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -2
- package/dist/runtime/composables/useOllama.js +8 -2
- package/dist/runtime/server/utils/useOllama.js +8 -2
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ Usage on pages or server side:
|
|
|
43
43
|
const ollama = useOllama()
|
|
44
44
|
|
|
45
45
|
const response = await ollama.chat({
|
|
46
|
-
model: '
|
|
46
|
+
model: 'gpt-oss:120b',
|
|
47
47
|
messages: [{ role: 'user', content: 'Why is the sky blue?' }],
|
|
48
48
|
})
|
|
49
49
|
console.log(response.message.content)
|
|
@@ -53,6 +53,8 @@ See [documentation](https://nuxt-ollama.jericho.dev/) for more information or ex
|
|
|
53
53
|
|
|
54
54
|
## Settings
|
|
55
55
|
|
|
56
|
+
### Local models
|
|
57
|
+
|
|
56
58
|
```ts
|
|
57
59
|
// nuxt.config.ts
|
|
58
60
|
export default defineNuxtConfig({
|
|
@@ -66,11 +68,26 @@ export default defineNuxtConfig({
|
|
|
66
68
|
})
|
|
67
69
|
```
|
|
68
70
|
|
|
71
|
+
### - Cloud models with API key on https://ollama.com
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
// nuxt.config.ts
|
|
75
|
+
export default defineNuxtConfig({
|
|
76
|
+
//...
|
|
77
|
+
ollama: {
|
|
78
|
+
protocol: 'https', // or 'https'
|
|
79
|
+
host: 'ollama.com', //domain or ip address
|
|
80
|
+
api_key: 'your_api_key_here' // your Ollama API key
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
|
|
69
86
|
## Contribution
|
|
70
87
|
|
|
71
88
|
Contributions are welcome, feel free to open an issue or submit a pull request!
|
|
72
89
|
|
|
73
|
-
|
|
90
|
+
Please see the [contributing guide](CONTRIBUTING.md) for details.
|
|
74
91
|
|
|
75
92
|
<details>
|
|
76
93
|
<summary>Local development</summary>
|
package/dist/module.d.mts
CHANGED
|
@@ -3,15 +3,17 @@ import * as _nuxt_schema from '@nuxt/schema';
|
|
|
3
3
|
interface OllamaOptions {
|
|
4
4
|
protocol: string;
|
|
5
5
|
host: string;
|
|
6
|
-
port: number;
|
|
6
|
+
port: number | null;
|
|
7
7
|
proxy: boolean;
|
|
8
|
+
api_key: string | null;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
interface ModuleOptions extends OllamaOptions {
|
|
11
12
|
protocol: string;
|
|
12
13
|
host: string;
|
|
13
|
-
port: number;
|
|
14
|
+
port: number | null;
|
|
14
15
|
proxy: boolean;
|
|
16
|
+
api_key: string | null;
|
|
15
17
|
}
|
|
16
18
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
17
19
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -13,8 +13,9 @@ const module = defineNuxtModule({
|
|
|
13
13
|
defaults: {
|
|
14
14
|
protocol: "http",
|
|
15
15
|
host: "localhost",
|
|
16
|
-
port:
|
|
17
|
-
proxy: false
|
|
16
|
+
port: null,
|
|
17
|
+
proxy: false,
|
|
18
|
+
api_key: null
|
|
18
19
|
},
|
|
19
20
|
setup(_options, _nuxt) {
|
|
20
21
|
const resolver = createResolver(import.meta.url);
|
|
@@ -2,8 +2,14 @@ import { Ollama } from "ollama/browser";
|
|
|
2
2
|
import { useRuntimeConfig } from "#imports";
|
|
3
3
|
export function useOllama() {
|
|
4
4
|
const options = useRuntimeConfig().public.ollama;
|
|
5
|
+
const headers = {};
|
|
6
|
+
if (options.api_key) {
|
|
7
|
+
headers.Authorization = `Bearer ${options.api_key}`;
|
|
8
|
+
}
|
|
9
|
+
const host = `${options.protocol}://${options.host}${options.port ? `:${options.port}` : ""}`;
|
|
5
10
|
return new Ollama({
|
|
6
|
-
host
|
|
7
|
-
proxy: options.proxy
|
|
11
|
+
host,
|
|
12
|
+
proxy: options.proxy,
|
|
13
|
+
headers
|
|
8
14
|
});
|
|
9
15
|
}
|
|
@@ -2,8 +2,14 @@ import { Ollama } from "ollama";
|
|
|
2
2
|
import { useRuntimeConfig } from "#imports";
|
|
3
3
|
export function useOllama() {
|
|
4
4
|
const options = useRuntimeConfig().public.ollama;
|
|
5
|
+
const headers = {};
|
|
6
|
+
if (options.api_key) {
|
|
7
|
+
headers.Authorization = `Bearer ${options.api_key}`;
|
|
8
|
+
}
|
|
9
|
+
const host = `${options.protocol}://${options.host}${options.port ? `:${options.port}` : ""}`;
|
|
5
10
|
return new Ollama({
|
|
6
|
-
host
|
|
7
|
-
proxy: options.proxy
|
|
11
|
+
host,
|
|
12
|
+
proxy: options.proxy,
|
|
13
|
+
headers
|
|
8
14
|
});
|
|
9
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-ollama",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "Easy ollama integration for Nuxt",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,25 +23,25 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^8.46.
|
|
27
|
-
"@typescript-eslint/parser": "^8.46.
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^8.46.3",
|
|
27
|
+
"@typescript-eslint/parser": "^8.46.3",
|
|
28
28
|
"defu": "^6.1.4",
|
|
29
|
-
"ollama": "^0.6.
|
|
29
|
+
"ollama": "^0.6.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@nuxt/devtools": "^3.0.
|
|
32
|
+
"@nuxt/devtools": "^3.0.1",
|
|
33
33
|
"@nuxt/eslint-config": "^1.10.0",
|
|
34
|
-
"@nuxt/kit": "^4.2.
|
|
34
|
+
"@nuxt/kit": "^4.2.1",
|
|
35
35
|
"@nuxt/module-builder": "^1.0.2",
|
|
36
|
-
"@nuxt/schema": "^4.2.
|
|
36
|
+
"@nuxt/schema": "^4.2.1",
|
|
37
37
|
"@nuxt/test-utils": "^3.20.1",
|
|
38
38
|
"@types/node": "latest",
|
|
39
39
|
"changelogen": "^0.6.2",
|
|
40
|
-
"eslint": "^9.
|
|
41
|
-
"nuxt": "^4.2.
|
|
40
|
+
"eslint": "^9.39.1",
|
|
41
|
+
"nuxt": "^4.2.1",
|
|
42
42
|
"typescript": "^5.9.3",
|
|
43
|
-
"vitest": "^
|
|
44
|
-
"vue-tsc": "^3.1.
|
|
43
|
+
"vitest": "^3.2.4",
|
|
44
|
+
"vue-tsc": "^3.1.3"
|
|
45
45
|
},
|
|
46
46
|
"volta": {
|
|
47
47
|
"node": "24.11.0"
|