specific prompt integration improved with two new methods: checkAPIIntegration and hasSpecificIntegration. see #438
This commit is contained in:
parent
98a48e1eb1
commit
9d52edbb2c
3 changed files with 17 additions and 12 deletions
|
|
@ -584,7 +584,11 @@ export function getActiveSpecialPromptsIDs(args = {}) {
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function checkSpecificIntegration(use, conntype){
|
export function checkAPIIntegration(connection_type, use_specific_integration, specific_integration_conntype){
|
||||||
|
return (connection_type !== "chatgpt_web") || (use_specific_integration && (specific_integration_conntype != null) && (specific_integration_conntype !== ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasSpecificIntegration(use, conntype){
|
||||||
return use && (conntype != null) && (conntype !== '');
|
return use && (conntype != null) && (conntype !== '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,8 @@ import {
|
||||||
htmlBodyToPlainText,
|
htmlBodyToPlainText,
|
||||||
convertNewlinesToParagraphs,
|
convertNewlinesToParagraphs,
|
||||||
getConnectionType,
|
getConnectionType,
|
||||||
checkSpecificIntegration,
|
checkAPIIntegration,
|
||||||
|
hasSpecificIntegration,
|
||||||
} from './js/mzta-utils.js';
|
} from './js/mzta-utils.js';
|
||||||
import { taPromptUtils } from './js/mzta-utils-prompt.js';
|
import { taPromptUtils } from './js/mzta-utils-prompt.js';
|
||||||
import { mzta_specialCommand } from './js/mzta-special-commands.js';
|
import { mzta_specialCommand } from './js/mzta-special-commands.js';
|
||||||
|
|
@ -85,7 +86,7 @@ taWorkingStatus.taLog = taLog;
|
||||||
|
|
||||||
let special_prompts_ids = getActiveSpecialPromptsIDs({
|
let special_prompts_ids = getActiveSpecialPromptsIDs({
|
||||||
addtags: prefs_init.add_tags,
|
addtags: prefs_init.add_tags,
|
||||||
addtags_api: checkSpecificIntegration(prefs_init.add_tags_use_specific_integration, prefs_init.add_tags_connection_type),
|
addtags_api: hasSpecificIntegration(prefs_init.add_tags_use_specific_integration, prefs_init.add_tags_connection_type),
|
||||||
get_calendar_event: doGetSparkFeature(prefs_init.get_calendar_event),
|
get_calendar_event: doGetSparkFeature(prefs_init.get_calendar_event),
|
||||||
get_task: doGetSparkFeature(prefs_init.get_task),
|
get_task: doGetSparkFeature(prefs_init.get_task),
|
||||||
is_chatgpt_web: (prefs_init.connection_type === "chatgpt_web")
|
is_chatgpt_web: (prefs_init.connection_type === "chatgpt_web")
|
||||||
|
|
@ -176,7 +177,7 @@ async function _reload_menus() {
|
||||||
let getTask = doGetSparkFeature(prefs_reload.get_task);
|
let getTask = doGetSparkFeature(prefs_reload.get_task);
|
||||||
const special_prompts_ids = getActiveSpecialPromptsIDs({
|
const special_prompts_ids = getActiveSpecialPromptsIDs({
|
||||||
addtags: prefs_reload.add_tags,
|
addtags: prefs_reload.add_tags,
|
||||||
addtags_api: checkSpecificIntegration(prefs_init.add_tags_use_specific_integration, prefs_init.add_tags_connection_type),
|
addtags_api: hasSpecificIntegration(prefs_init.add_tags_use_specific_integration, prefs_init.add_tags_connection_type),
|
||||||
get_calendar_event: getCalendarEvent,
|
get_calendar_event: getCalendarEvent,
|
||||||
get_task: getTask,
|
get_task: getTask,
|
||||||
is_chatgpt_web: (prefs_reload.connection_type === "chatgpt_web")
|
is_chatgpt_web: (prefs_reload.connection_type === "chatgpt_web")
|
||||||
|
|
@ -817,7 +818,7 @@ function setupStorageChangeListener() {
|
||||||
let getTask = doGetSparkFeature(prefs_init.get_task);
|
let getTask = doGetSparkFeature(prefs_init.get_task);
|
||||||
const special_prompts_ids = getActiveSpecialPromptsIDs({
|
const special_prompts_ids = getActiveSpecialPromptsIDs({
|
||||||
addtags: newTags,
|
addtags: newTags,
|
||||||
addtags_api: checkSpecificIntegration(prefs_init.add_tags_use_specific_integration, prefs_init.add_tags_connection_type),
|
addtags_api: hasSpecificIntegration(prefs_init.add_tags_use_specific_integration, prefs_init.add_tags_connection_type),
|
||||||
get_calendar_event: getCalendarEvent,
|
get_calendar_event: getCalendarEvent,
|
||||||
get_task: getTask,
|
get_task: getTask,
|
||||||
is_chatgpt_web: (prefs_init.connection_type === "chatgpt_web")
|
is_chatgpt_web: (prefs_init.connection_type === "chatgpt_web")
|
||||||
|
|
@ -832,7 +833,7 @@ function setupStorageChangeListener() {
|
||||||
let getTask = doGetSparkFeature(prefs_init.get_task);
|
let getTask = doGetSparkFeature(prefs_init.get_task);
|
||||||
const special_prompts_ids = getActiveSpecialPromptsIDs({
|
const special_prompts_ids = getActiveSpecialPromptsIDs({
|
||||||
addtags: prefs_init.add_tags,
|
addtags: prefs_init.add_tags,
|
||||||
addtags_api: checkSpecificIntegration(prefs_init.add_tags_use_specific_integration, prefs_init.add_tags_connection_type),
|
addtags_api: hasSpecificIntegration(prefs_init.add_tags_use_specific_integration, prefs_init.add_tags_connection_type),
|
||||||
get_calendar_event: getCalendarEvent,
|
get_calendar_event: getCalendarEvent,
|
||||||
get_task: getTask,
|
get_task: getTask,
|
||||||
is_chatgpt_web: (prefs_init.connection_type === "chatgpt_web")
|
is_chatgpt_web: (prefs_init.connection_type === "chatgpt_web")
|
||||||
|
|
@ -847,7 +848,7 @@ function setupStorageChangeListener() {
|
||||||
let getTask = doGetSparkFeature(newTask);
|
let getTask = doGetSparkFeature(newTask);
|
||||||
const special_prompts_ids = getActiveSpecialPromptsIDs({
|
const special_prompts_ids = getActiveSpecialPromptsIDs({
|
||||||
addtags: prefs_init.add_tags,
|
addtags: prefs_init.add_tags,
|
||||||
addtags_api: checkSpecificIntegration(prefs_init.add_tags_use_specific_integration, prefs_init.add_tags_connection_type),
|
addtags_api: hasSpecificIntegration(prefs_init.add_tags_use_specific_integration, prefs_init.add_tags_connection_type),
|
||||||
get_calendar_event: getCalendarEvent,
|
get_calendar_event: getCalendarEvent,
|
||||||
get_task: getTask,
|
get_task: getTask,
|
||||||
is_chatgpt_web: (prefs_init.connection_type === "chatgpt_web")
|
is_chatgpt_web: (prefs_init.connection_type === "chatgpt_web")
|
||||||
|
|
@ -862,7 +863,7 @@ function setupStorageChangeListener() {
|
||||||
let getTask = doGetSparkFeature(prefs_init.get_task);
|
let getTask = doGetSparkFeature(prefs_init.get_task);
|
||||||
const special_prompts_ids = getActiveSpecialPromptsIDs({
|
const special_prompts_ids = getActiveSpecialPromptsIDs({
|
||||||
addtags: prefs_init.add_tags,
|
addtags: prefs_init.add_tags,
|
||||||
addtags_api: checkSpecificIntegration(prefs_init.add_tags_use_specific_integration, prefs_init.add_tags_connection_type),
|
addtags_api: hasSpecificIntegration(prefs_init.add_tags_use_specific_integration, prefs_init.add_tags_connection_type),
|
||||||
get_calendar_event: getCalendarEvent,
|
get_calendar_event: getCalendarEvent,
|
||||||
get_task: getTask,
|
get_task: getTask,
|
||||||
is_chatgpt_web: (newConnectionType === "chatgpt_web")
|
is_chatgpt_web: (newConnectionType === "chatgpt_web")
|
||||||
|
|
@ -961,12 +962,12 @@ function removeContextMenu(menu_id) {
|
||||||
|
|
||||||
function addContextMenuItems() {
|
function addContextMenuItems() {
|
||||||
// Add Context menu: Add tags
|
// Add Context menu: Add tags
|
||||||
if(prefs_init.add_tags && prefs_init.add_tags_context_menu && ((prefs_init.connection_type !== "chatgpt_web")||checkSpecificIntegration(prefs_init.add_tags_use_specific_integration,prefs_init.add_tags_connection_type))){
|
if(prefs_init.add_tags && prefs_init.add_tags_context_menu && checkAPIIntegration(prefs_init.connection_type, prefs_init.add_tags_use_specific_integration,prefs_init.add_tags_connection_type)){
|
||||||
addContextMenu(contextMenuID_AddTags);
|
addContextMenu(contextMenuID_AddTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Context menu: Spamfilter
|
// Add Context menu: Spamfilter
|
||||||
if(prefs_init.spamfilter && prefs_init.spamfilter_context_menu && ((prefs_init.connection_type !== "chatgpt_web")||checkSpecificIntegration(prefs_init.spamfilter_use_specific_integration,prefs_init.spamfilter_connection_type))){
|
if(prefs_init.spamfilter && prefs_init.spamfilter_context_menu && checkAPIIntegration(prefs_init.connection_type, prefs_init.spamfilter_use_specific_integration,prefs_init.spamfilter_connection_type)){
|
||||||
addContextMenu(contextMenuID_Spamfilter);
|
addContextMenu(contextMenuID_Spamfilter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import { prefs_default } from "../options/mzta-options-default.js";
|
||||||
import { taLogger } from "../js/mzta-logger.js";
|
import { taLogger } from "../js/mzta-logger.js";
|
||||||
import {
|
import {
|
||||||
checkSparksPresence,
|
checkSparksPresence,
|
||||||
checkSpecificIntegration,
|
checkAPIIntegration,
|
||||||
} from "../js/mzta-utils.js";
|
} from "../js/mzta-utils.js";
|
||||||
|
|
||||||
let menuSendImmediately = false;
|
let menuSendImmediately = false;
|
||||||
|
|
@ -371,7 +371,7 @@ function filterPromptsForTab(prompts_data, filtering){
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkDoAddTags(){
|
function checkDoAddTags(){
|
||||||
return add_tags && ((connection_type !== "chatgpt_web" || checkSpecificIntegration(add_tags_use_specific_integration,add_tags_connection_type)) && tabType !== 'messageCompose');
|
return add_tags && checkAPIIntegration(connection_type, add_tags_use_specific_integration,add_tags_connection_type) && (tabType !== 'messageCompose');
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkDoCalendarEvent(){
|
function checkDoCalendarEvent(){
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue