nuxt-ollama 1.1.2 → 1.2.2

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 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: 'llama3.1',
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
- *guidelines coming soon*
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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=4.0.0"
6
6
  },
7
- "version": "1.1.2",
7
+ "version": "1.2.2",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
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: 11434,
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: `${options.protocol}://${options.host}:${options.port}`,
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: `${options.protocol}://${options.host}:${options.port}`,
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.1.2",
3
+ "version": "1.2.2",
4
4
  "description": "Easy ollama integration for Nuxt",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,19 +29,22 @@
29
29
  "ollama": "^0.6.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@nuxt/devtools": "^2.6.5",
33
- "@nuxt/eslint-config": "^1.9.0",
32
+ "@nuxt/devtools": "^3.0.0",
33
+ "@nuxt/eslint-config": "^1.10.0",
34
34
  "@nuxt/kit": "^4.2.0",
35
35
  "@nuxt/module-builder": "^1.0.2",
36
36
  "@nuxt/schema": "^4.2.0",
37
37
  "@nuxt/test-utils": "^3.20.1",
38
38
  "@types/node": "latest",
39
- "changelogen": "^0.5.7",
39
+ "changelogen": "^0.6.2",
40
40
  "eslint": "^9.38.0",
41
41
  "nuxt": "^4.2.0",
42
42
  "typescript": "^5.9.3",
43
- "vitest": "^3.2.4",
44
- "vue-tsc": "^2.2.12"
43
+ "vitest": "^4.0.5",
44
+ "vue-tsc": "^3.1.2"
45
+ },
46
+ "volta": {
47
+ "node": "24.11.0"
45
48
  },
46
49
  "scripts": {
47
50
  "dev": "nuxi dev playground",