mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: rename group to namespace
This commit is contained in:
parent
7f9b5e1b58
commit
9ca46a07c6
@ -1,5 +1,5 @@
|
||||
import DEFAULT_LIVE_CHAT_TEST_SETTINGS, {
|
||||
LIVE_CHAT_TEST_GROUP_NAME,
|
||||
LIVE_CHAT_TEST_CHANNEL_NAMESPACE,
|
||||
} from './settings';
|
||||
|
||||
declare global {
|
||||
@ -9,7 +9,7 @@ declare global {
|
||||
|
||||
declare module '@nestjs/event-emitter' {
|
||||
interface IHookExtensionsOperationMap {
|
||||
[LIVE_CHAT_TEST_GROUP_NAME]: TDefinition<
|
||||
[LIVE_CHAT_TEST_CHANNEL_NAMESPACE]: TDefinition<
|
||||
object,
|
||||
SettingMapByType<typeof DEFAULT_LIVE_CHAT_TEST_SETTINGS>
|
||||
>;
|
||||
|
@ -14,78 +14,78 @@ import { Offline } from '../offline/types';
|
||||
|
||||
export const LIVE_CHAT_TEST_CHANNEL_NAME = 'live-chat-tester-channel';
|
||||
|
||||
export const LIVE_CHAT_TEST_GROUP_NAME = 'live_chat_tester_channel';
|
||||
export const LIVE_CHAT_TEST_CHANNEL_NAMESPACE = 'live_chat_tester_channel';
|
||||
|
||||
export default [
|
||||
{
|
||||
group: LIVE_CHAT_TEST_GROUP_NAME,
|
||||
group: LIVE_CHAT_TEST_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.verification_token,
|
||||
value: 'test',
|
||||
type: SettingType.text,
|
||||
},
|
||||
{
|
||||
group: LIVE_CHAT_TEST_GROUP_NAME,
|
||||
group: LIVE_CHAT_TEST_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.allowed_domains,
|
||||
value: config.frontendPath,
|
||||
type: SettingType.text,
|
||||
},
|
||||
{
|
||||
group: LIVE_CHAT_TEST_GROUP_NAME,
|
||||
group: LIVE_CHAT_TEST_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.start_button,
|
||||
value: true,
|
||||
type: SettingType.checkbox,
|
||||
},
|
||||
{
|
||||
group: LIVE_CHAT_TEST_GROUP_NAME,
|
||||
group: LIVE_CHAT_TEST_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.input_disabled,
|
||||
value: false,
|
||||
type: SettingType.checkbox,
|
||||
},
|
||||
{
|
||||
group: LIVE_CHAT_TEST_GROUP_NAME,
|
||||
group: LIVE_CHAT_TEST_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.persistent_menu,
|
||||
value: true,
|
||||
type: SettingType.checkbox,
|
||||
},
|
||||
{
|
||||
group: LIVE_CHAT_TEST_GROUP_NAME,
|
||||
group: LIVE_CHAT_TEST_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.greeting_message,
|
||||
value: 'Welcome! Ready to start a conversation with our chatbot?',
|
||||
type: SettingType.textarea,
|
||||
},
|
||||
{
|
||||
group: LIVE_CHAT_TEST_GROUP_NAME,
|
||||
group: LIVE_CHAT_TEST_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.theme_color,
|
||||
value: 'teal',
|
||||
type: SettingType.select,
|
||||
options: ['teal', 'orange', 'red', 'green', 'blue', 'dark'],
|
||||
},
|
||||
{
|
||||
group: LIVE_CHAT_TEST_GROUP_NAME,
|
||||
group: LIVE_CHAT_TEST_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.show_emoji,
|
||||
value: true,
|
||||
type: SettingType.checkbox,
|
||||
},
|
||||
{
|
||||
group: LIVE_CHAT_TEST_GROUP_NAME,
|
||||
group: LIVE_CHAT_TEST_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.show_file,
|
||||
value: true,
|
||||
type: SettingType.checkbox,
|
||||
},
|
||||
{
|
||||
group: LIVE_CHAT_TEST_GROUP_NAME,
|
||||
group: LIVE_CHAT_TEST_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.show_location,
|
||||
value: true,
|
||||
type: SettingType.checkbox,
|
||||
},
|
||||
{
|
||||
group: LIVE_CHAT_TEST_GROUP_NAME,
|
||||
group: LIVE_CHAT_TEST_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.allowed_upload_size,
|
||||
value: 2500000,
|
||||
type: SettingType.number,
|
||||
},
|
||||
{
|
||||
group: LIVE_CHAT_TEST_GROUP_NAME,
|
||||
group: LIVE_CHAT_TEST_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.allowed_upload_types,
|
||||
value:
|
||||
'audio/mpeg,audio/x-ms-wma,audio/vnd.rn-realaudio,audio/x-wav,image/gif,image/jpeg,image/png,image/tiff,image/vnd.microsoft.icon,image/vnd.djvu,image/svg+xml,text/css,text/csv,text/html,text/plain,text/xml,video/mpeg,video/mp4,video/quicktime,video/x-ms-wmv,video/x-msvideo,video/x-flv,video/web,application/msword,application/vnd.ms-powerpoint,application/pdf,application/vnd.ms-excel,application/vnd.oasis.opendocument.presentation,application/vnd.oasis.opendocument.tex,application/vnd.oasis.opendocument.spreadsheet,application/vnd.oasis.opendocument.graphics,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
|
@ -58,7 +58,7 @@ import { SocketRequest } from '@/websocket/utils/socket-request';
|
||||
import { SocketResponse } from '@/websocket/utils/socket-response';
|
||||
import { WebsocketGateway } from '@/websocket/websocket.gateway';
|
||||
|
||||
import { OFFLINE_GROUP_NAME } from './settings';
|
||||
import { OFFLINE_CHANNEL_NAMESPACE } from './settings';
|
||||
import { Offline } from './types';
|
||||
import OfflineEventWrapper from './wrapper';
|
||||
|
||||
@ -299,7 +299,7 @@ export default abstract class BaseWebChannelHandler<
|
||||
*/
|
||||
private async verifyToken(verificationToken: string) {
|
||||
const settings =
|
||||
(await this.getSettings()) as Settings[typeof OFFLINE_GROUP_NAME];
|
||||
(await this.getSettings()) as Settings[typeof OFFLINE_CHANNEL_NAMESPACE];
|
||||
const verifyToken = settings.verification_token;
|
||||
|
||||
if (!verifyToken) {
|
||||
@ -326,7 +326,7 @@ export default abstract class BaseWebChannelHandler<
|
||||
req: Request | SocketRequest,
|
||||
res: Response | SocketResponse,
|
||||
) {
|
||||
const settings = await this.getSettings<typeof OFFLINE_GROUP_NAME>();
|
||||
const settings = await this.getSettings<typeof OFFLINE_CHANNEL_NAMESPACE>();
|
||||
// If we have an origin header...
|
||||
if (req.headers && req.headers.origin) {
|
||||
// Get the allowed origins
|
||||
|
@ -1,4 +1,6 @@
|
||||
import DEFAULT_OFFLINE_SETTINGS, { OFFLINE_GROUP_NAME } from './settings';
|
||||
import DEFAULT_OFFLINE_SETTINGS, {
|
||||
OFFLINE_CHANNEL_NAMESPACE,
|
||||
} from './settings';
|
||||
|
||||
declare global {
|
||||
interface Settings extends SettingTree<typeof DEFAULT_OFFLINE_SETTINGS> {}
|
||||
@ -6,7 +8,7 @@ declare global {
|
||||
|
||||
declare module '@nestjs/event-emitter' {
|
||||
interface IHookExtensionsOperationMap {
|
||||
[OFFLINE_GROUP_NAME]: TDefinition<
|
||||
[OFFLINE_CHANNEL_NAMESPACE]: TDefinition<
|
||||
object,
|
||||
SettingMapByType<typeof DEFAULT_OFFLINE_SETTINGS>
|
||||
>;
|
||||
|
@ -13,90 +13,90 @@ import { Offline } from './types';
|
||||
|
||||
export const OFFLINE_CHANNEL_NAME = 'offline-channel' as const;
|
||||
|
||||
export const OFFLINE_GROUP_NAME = 'offline_channel';
|
||||
export const OFFLINE_CHANNEL_NAMESPACE = 'offline_channel';
|
||||
|
||||
export default [
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.verification_token,
|
||||
value: 'token123',
|
||||
type: SettingType.secret,
|
||||
},
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.allowed_domains,
|
||||
value: 'http://localhost:8080,http://localhost:4000',
|
||||
type: SettingType.text,
|
||||
},
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.start_button,
|
||||
value: true,
|
||||
type: SettingType.checkbox,
|
||||
},
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.input_disabled,
|
||||
value: false,
|
||||
type: SettingType.checkbox,
|
||||
},
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.persistent_menu,
|
||||
value: true,
|
||||
type: SettingType.checkbox,
|
||||
},
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.greeting_message,
|
||||
value: 'Welcome! Ready to start a conversation with our chatbot?',
|
||||
type: SettingType.textarea,
|
||||
},
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.theme_color,
|
||||
value: 'teal',
|
||||
type: SettingType.select,
|
||||
options: ['teal', 'orange', 'red', 'green', 'blue', 'dark'],
|
||||
},
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.window_title,
|
||||
value: 'Widget Title',
|
||||
type: SettingType.text,
|
||||
},
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.avatar_url,
|
||||
value: 'https://eu.ui-avatars.com/api/?name=Hexa+Bot&size=64',
|
||||
type: SettingType.text,
|
||||
},
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.show_emoji,
|
||||
value: true,
|
||||
type: SettingType.checkbox,
|
||||
},
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.show_file,
|
||||
value: true,
|
||||
type: SettingType.checkbox,
|
||||
},
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.show_location,
|
||||
value: true,
|
||||
type: SettingType.checkbox,
|
||||
},
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.allowed_upload_size,
|
||||
value: 2500000,
|
||||
type: SettingType.number,
|
||||
},
|
||||
{
|
||||
group: OFFLINE_GROUP_NAME,
|
||||
group: OFFLINE_CHANNEL_NAMESPACE,
|
||||
label: Offline.SettingLabel.allowed_upload_types,
|
||||
value:
|
||||
'audio/mpeg,audio/x-ms-wma,audio/vnd.rn-realaudio,audio/x-wav,image/gif,image/jpeg,image/png,image/tiff,image/vnd.microsoft.icon,image/vnd.djvu,image/svg+xml,text/css,text/csv,text/html,text/plain,text/xml,video/mpeg,video/mp4,video/quicktime,video/x-ms-wmv,video/x-msvideo,video/x-flv,video/web,application/msword,application/vnd.ms-powerpoint,application/pdf,application/vnd.ms-excel,application/vnd.oasis.opendocument.presentation,application/vnd.oasis.opendocument.tex,application/vnd.oasis.opendocument.spreadsheet,application/vnd.oasis.opendocument.graphics,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
|
@ -1,4 +1,6 @@
|
||||
import CORE_NLU_HELPER_SETTINGS, { CORE_NLU_HELPER_GROUP } from './settings';
|
||||
import CORE_NLU_HELPER_SETTINGS, {
|
||||
CORE_NLU_HELPER_NAMESPACE,
|
||||
} from './settings';
|
||||
|
||||
declare global {
|
||||
interface Settings extends SettingTree<typeof CORE_NLU_HELPER_SETTINGS> {}
|
||||
@ -6,7 +8,7 @@ declare global {
|
||||
|
||||
declare module '@nestjs/event-emitter' {
|
||||
interface IHookExtensionsOperationMap {
|
||||
[CORE_NLU_HELPER_GROUP]: TDefinition<
|
||||
[CORE_NLU_HELPER_NAMESPACE]: TDefinition<
|
||||
object,
|
||||
SettingMapByType<typeof CORE_NLU_HELPER_SETTINGS>
|
||||
>;
|
||||
|
@ -3,23 +3,23 @@ import { SettingType } from '@/setting/schemas/types';
|
||||
|
||||
export const CORE_NLU_HELPER_NAME = 'core-nlu-helper';
|
||||
|
||||
export const CORE_NLU_HELPER_GROUP = 'core_nlu_helper';
|
||||
export const CORE_NLU_HELPER_NAMESPACE = 'core_nlu_helper';
|
||||
|
||||
export default [
|
||||
{
|
||||
group: CORE_NLU_HELPER_GROUP,
|
||||
group: CORE_NLU_HELPER_NAMESPACE,
|
||||
label: 'endpoint',
|
||||
value: 'http://nlu-api:5000/',
|
||||
type: SettingType.text,
|
||||
},
|
||||
{
|
||||
group: CORE_NLU_HELPER_GROUP,
|
||||
group: CORE_NLU_HELPER_NAMESPACE,
|
||||
label: 'token',
|
||||
value: 'token123',
|
||||
type: SettingType.text,
|
||||
},
|
||||
{
|
||||
group: CORE_NLU_HELPER_GROUP,
|
||||
group: CORE_NLU_HELPER_NAMESPACE,
|
||||
label: 'threshold',
|
||||
value: 0.1,
|
||||
type: SettingType.number,
|
||||
|
4
api/src/extensions/helpers/ollama/index.d.ts
vendored
4
api/src/extensions/helpers/ollama/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
import OLLAMA_HELPER_SETTINGS, { OLLAMA_HELPER_GROUP } from './settings';
|
||||
import OLLAMA_HELPER_SETTINGS, { OLLAMA_HELPER_NAMESPACE } from './settings';
|
||||
|
||||
declare global {
|
||||
interface Settings extends SettingTree<typeof OLLAMA_HELPER_SETTINGS> {}
|
||||
@ -6,7 +6,7 @@ declare global {
|
||||
|
||||
declare module '@nestjs/event-emitter' {
|
||||
interface IHookExtensionsOperationMap {
|
||||
[OLLAMA_HELPER_GROUP]: TDefinition<
|
||||
[OLLAMA_HELPER_NAMESPACE]: TDefinition<
|
||||
object,
|
||||
SettingMapByType<typeof OLLAMA_HELPER_SETTINGS>
|
||||
>;
|
||||
|
@ -3,123 +3,123 @@ import { SettingType } from '@/setting/schemas/types';
|
||||
|
||||
export const OLLAMA_HELPER_NAME = 'ollama-helper';
|
||||
|
||||
export const OLLAMA_HELPER_GROUP: HyphenToUnderscore<
|
||||
export const OLLAMA_HELPER_NAMESPACE: HyphenToUnderscore<
|
||||
typeof OLLAMA_HELPER_NAME
|
||||
> = 'ollama_helper';
|
||||
|
||||
export default [
|
||||
{
|
||||
label: 'api_url',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
type: SettingType.text,
|
||||
value: 'http://ollama:11434', // Default value
|
||||
},
|
||||
{
|
||||
label: 'model',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
type: SettingType.text,
|
||||
value: 'llama3.2', // Default model
|
||||
},
|
||||
{
|
||||
label: 'keep_alive',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
type: SettingType.text,
|
||||
value: '5m', // Default value for keeping the model in memory
|
||||
},
|
||||
{
|
||||
label: 'mirostat',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.number,
|
||||
value: 0, // Default: disabled
|
||||
},
|
||||
{
|
||||
label: 'mirostat_eta',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.number,
|
||||
value: 0.1, // Default value
|
||||
},
|
||||
{
|
||||
label: 'mirostat_tau',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.number,
|
||||
value: 5.0, // Default value
|
||||
},
|
||||
{
|
||||
label: 'num_ctx',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.number,
|
||||
value: 2048, // Default value
|
||||
},
|
||||
{
|
||||
label: 'repeat_last_n',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.number,
|
||||
value: 64, // Default value
|
||||
},
|
||||
{
|
||||
label: 'repeat_penalty',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.number,
|
||||
value: 1.1, // Default value
|
||||
},
|
||||
{
|
||||
label: 'temperature',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.number,
|
||||
value: 0.8, // Default value
|
||||
},
|
||||
{
|
||||
label: 'seed',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.number,
|
||||
value: 0, // Default value
|
||||
},
|
||||
{
|
||||
label: 'stop',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.text,
|
||||
value: 'AI assistant:', // Default stop sequence
|
||||
},
|
||||
{
|
||||
label: 'tfs_z',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.number,
|
||||
value: 1, // Default value, 1.0 means disabled
|
||||
},
|
||||
{
|
||||
label: 'num_predict',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.number,
|
||||
value: 20, // Default value
|
||||
},
|
||||
{
|
||||
label: 'top_k',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.number,
|
||||
value: 40, // Default value
|
||||
},
|
||||
{
|
||||
label: 'top_p',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.number,
|
||||
value: 0.9, // Default value
|
||||
},
|
||||
{
|
||||
label: 'min_p',
|
||||
group: OLLAMA_HELPER_GROUP,
|
||||
group: OLLAMA_HELPER_NAMESPACE,
|
||||
subgroup: 'options',
|
||||
type: SettingType.number,
|
||||
value: 0.0, // Default value
|
||||
|
Loading…
Reference in New Issue
Block a user