Skip to content

Commit 36473cb

Browse files
committed
fixed errors for local build
1 parent b26f703 commit 36473cb

File tree

7 files changed

+23
-38
lines changed

7 files changed

+23
-38
lines changed

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"version": "0.0.0",
55
"type": "module",
66
"scripts": {
7+
"clean-target": "rm -rf ./src-tauri/target",
8+
"build:app:silicon": "pnpm clean-target && tauri build --target aarch64-apple-darwin",
79
"dev": "vite",
810
"build": "tsc && vite build",
911
"preview": "vite preview",
@@ -46,4 +48,4 @@
4648
"typescript": "^5.2.2",
4749
"vite": "^5.3.1"
4850
}
49-
}
51+
}

src-tauri/tauri.conf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"productName": "ollama-chat",
33
"version": "0.0.0",
4-
"identifier": "com.tauri.dev",
4+
"identifier": "com.twanluttik.ollama-interface",
55
"build": {
66
"beforeDevCommand": "pnpm dev",
77
"devUrl": "http://localhost:1420",

src/app/index.tsx

+7-8
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@ import { useEffect } from "react";
22
import { actions, core, syncModels } from "@/core";
33
import { loadDB } from "@/core/local-database";
44
import { Sidebar } from "@/app/parts/sidebar";
5-
import { Command } from "@tauri-apps/plugin-shell";
65
import { ChatWindow } from "./parts/chat-window";
76
import { SettingsWrapper } from "./parts/settings-wrapper";
87

98
// Load the database on the app frame
109
loadDB();
1110

1211
export const AppFrame = () => {
13-
async function startServer() {
14-
let result = await Command.create("ollama-server", [
15-
"-c",
16-
"OLLAMA_ORIGINS=* OLLAMA_HOST=127.0.0.1:11434 ollama serve",
17-
]).execute();
18-
console.log(result);
19-
}
12+
// async function startServer() {
13+
// let result = await Command.create("ollama-server", [
14+
// "-c",
15+
// "OLLAMA_ORIGINS=* OLLAMA_HOST=127.0.0.1:11434 ollama serve",
16+
// ]).execute();
17+
// console.log(result);
18+
// }
2019

2120
const loadAppData = async () => {
2221
// Load available models

src/app/parts/chat-message.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const ChatMessage = (props: ChatMessageProps) => {
99

1010
const parseText = useCallback(async () => {
1111
const p = await marked.parse(props.message);
12-
contentRef.current.innerHTML = p;
12+
if (contentRef?.current) contentRef.current.innerHTML = p;
1313
}, [props.message]);
1414

1515
useEffect(() => {

src/app/parts/chat-window.tsx

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ChatHeader } from "./chat-header";
2-
import { Command } from "@tauri-apps/plugin-shell";
32
import { Input } from "@/components/ui/input";
43
import { useCallback, useState } from "react";
54
import {
@@ -38,13 +37,13 @@ export const ChatWindow = () => {
3837
}, [messages, conv_id]);
3938

4039
// TODO: We need to move this function to a life cycle for auto restart feature
41-
async function startServer() {
42-
let result = await Command.create("ollama-server", [
43-
"-c",
44-
"OLLAMA_ORIGINS=* OLLAMA_HOST=127.0.0.1:11434 ollama serve",
45-
]).execute();
46-
console.log(result);
47-
}
40+
// async function startServer() {
41+
// let result = await Command.create("ollama-server", [
42+
// "-c",
43+
// "OLLAMA_ORIGINS=* OLLAMA_HOST=127.0.0.1:11434 ollama serve",
44+
// ]).execute();
45+
// console.log(result);
46+
// }
4847

4948
const changeModel = (model_name: string) => {
5049
// Update last used
@@ -89,7 +88,7 @@ export const ChatWindow = () => {
8988
message: m,
9089
created_at: dayjs().toDate(),
9190
ai_replied: false,
92-
ctx: null,
91+
ctx: "",
9392
};
9493

9594
// save the send prompt in db
@@ -105,7 +104,7 @@ export const ChatWindow = () => {
105104

106105
let lastCtx = [];
107106
if (messages.length > 1) {
108-
lastCtx = JSON.parse(messages[1].ctx);
107+
lastCtx = JSON.parse((messages[1].ctx as string) || "");
109108
}
110109

111110
if (messages?.length === 0) {

tsconfig.app.json

-12
This file was deleted.

tsconfig.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
"@/*": ["./src/*"]
2525
}
2626
},
27-
"include": ["src"],
28-
"references": [
29-
{ "path": "./tsconfig.node.json" },
30-
{ "path": "./tsconfig.app.json" }
31-
]
27+
"include": ["src", "tsconfig.json"],
28+
"references": [{ "path": "./tsconfig.node.json" }]
3229
}

0 commit comments

Comments
 (0)