omnibot3000 1.10.3 → 1.10.5
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/.github/workflows/keep_alive.yml +15 -2
- package/.husky/commit-msg +8 -2
- package/package.json +1 -1
- package/src/commons/api/api.ts +2 -2
- package/src/commons/api/utils/getData.ts +2 -1
- package/src/commons/api/utils/getStream.ts +2 -1
- package/src/commons/constants.ts +2 -0
- package/src/features/version/Version.tsx +2 -7
- package/vite.config.ts +3 -1
|
@@ -2,12 +2,25 @@ name: keep render alive
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
schedule:
|
|
5
|
-
|
|
5
|
+
# Staggered schedules reduce the chance of skipped runs during top-of-hour load.
|
|
6
|
+
- cron: "1,6,11,16,21,26,31,36,41,46,51,56 * * * *"
|
|
7
|
+
- cron: "3,8,13,18,23,28,33,38,43,48,53,58 * * * *"
|
|
6
8
|
workflow_dispatch:
|
|
7
9
|
|
|
8
10
|
jobs:
|
|
9
11
|
ping:
|
|
10
12
|
runs-on: ubuntu-latest
|
|
13
|
+
timeout-minutes: 2
|
|
11
14
|
steps:
|
|
12
15
|
- name: Ping Render
|
|
13
|
-
run:
|
|
16
|
+
run: |
|
|
17
|
+
curl \
|
|
18
|
+
--fail \
|
|
19
|
+
--show-error \
|
|
20
|
+
--silent \
|
|
21
|
+
--connect-timeout 10 \
|
|
22
|
+
--max-time 25 \
|
|
23
|
+
--retry 5 \
|
|
24
|
+
--retry-delay 5 \
|
|
25
|
+
--retry-all-errors \
|
|
26
|
+
https://omnibot3000.onrender.com/api/config
|
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";
|
|
@@ -14,9 +14,6 @@ import styles from "@version/Version.module.css";
|
|
|
14
14
|
|
|
15
15
|
import cls from "classnames";
|
|
16
16
|
|
|
17
|
-
const API_PORT = Number(import.meta.env.API_PORT) || 3001;
|
|
18
|
-
const API_PATH = import.meta.env.API_PATH || "/api";
|
|
19
|
-
|
|
20
17
|
interface Package {
|
|
21
18
|
name: string;
|
|
22
19
|
version: [number, number, number];
|
|
@@ -24,8 +21,6 @@ interface Package {
|
|
|
24
21
|
error?: string[];
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
export const PACKAGES_API = `${window.location.origin}:${API_PORT}${API_PATH}/packages`;
|
|
28
|
-
|
|
29
24
|
const Version = () => {
|
|
30
25
|
const chatStore = useChatCompletionStore();
|
|
31
26
|
|
|
@@ -35,7 +30,7 @@ const Version = () => {
|
|
|
35
30
|
const [loading, setLoading] = useState<boolean>(false);
|
|
36
31
|
|
|
37
32
|
const getResponse = async () => {
|
|
38
|
-
const data = await fetch(
|
|
33
|
+
const data = await fetch(`${API_PATH}/packages`);
|
|
39
34
|
|
|
40
35
|
if (data.status !== 200) {
|
|
41
36
|
const error = JSON.parse(await data.text()).error;
|
package/vite.config.ts
CHANGED
|
@@ -14,12 +14,14 @@ export default defineConfig(({mode}) => {
|
|
|
14
14
|
]);
|
|
15
15
|
|
|
16
16
|
console.info(
|
|
17
|
-
"\n\x1b[1m\x1b[32m%s\x1b[0m %s \x1b[32m%s\x1b[0m %s \x1b[36m%s\x1b[0m",
|
|
17
|
+
"\n\x1b[1m\x1b[32m%s\x1b[0m %s \x1b[32m%s\n\n \x1b[0m %s \x1b[36m%s\n \x1b[0m %s \x1b[36m%s\x1b[0m",
|
|
18
18
|
"→",
|
|
19
19
|
"Running",
|
|
20
20
|
`${pkg["x-display-name"]} v${pkg.version}`,
|
|
21
21
|
"dev server at",
|
|
22
22
|
`http://${env.DOMAIN}:${env.DEV_PORT}`,
|
|
23
|
+
"API server at",
|
|
24
|
+
`${env.API_PATH}:${env.API_PORT}`,
|
|
23
25
|
);
|
|
24
26
|
|
|
25
27
|
return {
|