omnibot3000 1.10.3 → 1.10.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/.husky/commit-msg
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
# basic commit message validation
|
|
2
2
|
|
|
3
|
-
if ! head -1 "$1" | grep -qE '^\[(feat|fix|update|doc|style|perf|test|conf|chore|misc)(\(.+\))?!?\]'; then
|
|
3
|
+
if ! head -1 "$1" | grep -qE '^\[(feat|fix|update|doc|style|perf|test|conf|chore|api|misc)(\(.+\))?!?\]'; then
|
|
4
4
|
echo "❌ Commit message must follow format: [type] message"
|
|
5
5
|
echo ""
|
|
6
6
|
echo "Examples:"
|
|
7
7
|
echo " [feat] add new feature"
|
|
8
8
|
echo " [fix] resolve bug in component"
|
|
9
|
+
echo " [update] improve functionality"
|
|
9
10
|
echo " [doc] update README"
|
|
10
|
-
echo " [
|
|
11
|
+
echo " [style] code formatting and styling"
|
|
12
|
+
echo " [perf] enhance performance"
|
|
13
|
+
echo " [test] add or update tests"
|
|
11
14
|
echo " [conf] modify configuration"
|
|
15
|
+
echo " [chore] update dependencies"
|
|
16
|
+
echo " [api] improve API code"
|
|
17
|
+
echo " [misc] miscellaneous changes"
|
|
12
18
|
exit 1
|
|
13
19
|
fi
|
package/package.json
CHANGED
package/src/commons/api/api.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {ChatCompletionMessageParam} from "openai/resources/index.mjs";
|
|
2
2
|
|
|
3
3
|
import getData from "@api/utils/getData";
|
|
4
|
-
import {NAME, VERSION} from "@commons/constants";
|
|
4
|
+
import {API_PATH, NAME, VERSION} from "@commons/constants";
|
|
5
5
|
import persona from "@commons/persona.txt?raw";
|
|
6
6
|
import {formatText} from "@utils/strings";
|
|
7
7
|
import {getVariableFromCSS} from "@utils/styles";
|
|
8
8
|
|
|
9
9
|
export const getApiConfig = async (): Promise<Record<string, string>> => {
|
|
10
|
-
const response = await fetch(
|
|
10
|
+
const response = await fetch(`${API_PATH}/config`);
|
|
11
11
|
return response.ok ? await response.json() : {};
|
|
12
12
|
};
|
|
13
13
|
|
|
@@ -2,6 +2,7 @@ import type {ChatCompletionMessageParam} from "openai/resources";
|
|
|
2
2
|
import type {ChatCompletion} from "openai/resources/index.mjs";
|
|
3
3
|
|
|
4
4
|
import {getSystemConfig} from "@api/api";
|
|
5
|
+
import {API_PATH} from "@commons/constants";
|
|
5
6
|
|
|
6
7
|
export const getData = async (
|
|
7
8
|
system?: string[],
|
|
@@ -21,7 +22,7 @@ export const getData = async (
|
|
|
21
22
|
content: query?.map((str) => str.trim()).join(". ") || "",
|
|
22
23
|
},
|
|
23
24
|
];
|
|
24
|
-
const response = await fetch(
|
|
25
|
+
const response = await fetch(`${API_PATH}/completion`, {
|
|
25
26
|
method: "POST",
|
|
26
27
|
headers: {
|
|
27
28
|
"Content-Type": "application/json",
|
|
@@ -3,6 +3,7 @@ import type {ChatCompletionChunk} from "openai/resources/index.mjs";
|
|
|
3
3
|
import {Stream} from "openai/streaming.mjs";
|
|
4
4
|
|
|
5
5
|
import {getSystemConfig} from "@api/api";
|
|
6
|
+
import {API_PATH} from "@commons/constants";
|
|
6
7
|
import {formatText} from "@utils/strings";
|
|
7
8
|
|
|
8
9
|
import type {CompletionEvent} from "@mistralai/mistralai/models/components";
|
|
@@ -10,7 +11,7 @@ import type {CompletionEvent} from "@mistralai/mistralai/models/components";
|
|
|
10
11
|
const fetchResponse = async (
|
|
11
12
|
messages: ChatCompletionMessageParam[],
|
|
12
13
|
): Promise<Response> => {
|
|
13
|
-
const response = await fetch(
|
|
14
|
+
const response = await fetch(`${API_PATH}/completion`, {
|
|
14
15
|
method: "POST",
|
|
15
16
|
headers: {
|
|
16
17
|
"Content-Type": "application/json",
|
package/src/commons/constants.ts
CHANGED
|
@@ -8,6 +8,8 @@ export const AUTHOR = pkg.author;
|
|
|
8
8
|
export const SOURCE = pkg.repository.url;
|
|
9
9
|
export const SESSION_KEY = String(NAME).toLowerCase().replace(/\s/g, "_");
|
|
10
10
|
|
|
11
|
+
export const API_PATH = import.meta.env.API_PATH || "/api";
|
|
12
|
+
|
|
11
13
|
export const COMPLETION_WILDCARD: RegExp = /chatcmpl-/gi;
|
|
12
14
|
|
|
13
15
|
export const ASCII_SPACE = "\u0020";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {memo, useEffect, useRef, useState} from "react";
|
|
2
2
|
|
|
3
|
-
import {NAME, VERSION} from "@commons/constants";
|
|
3
|
+
import {API_PATH, NAME, VERSION} from "@commons/constants";
|
|
4
4
|
import Container from "@layout/Container";
|
|
5
5
|
import Line from "@ui/Line";
|
|
6
6
|
import ProgressBar from "@ui/ProgressBar";
|
|
@@ -15,7 +15,6 @@ import styles from "@version/Version.module.css";
|
|
|
15
15
|
import cls from "classnames";
|
|
16
16
|
|
|
17
17
|
const API_PORT = Number(import.meta.env.API_PORT) || 3001;
|
|
18
|
-
const API_PATH = import.meta.env.API_PATH || "/api";
|
|
19
18
|
|
|
20
19
|
interface Package {
|
|
21
20
|
name: string;
|