Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 0 additions & 77 deletions inc/Core/Admin/Pages/Pipelines/PipelinesFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,82 +91,5 @@ function ( $pages ) {
);
}

/**
* Get AI providers formatted for React
*
* @return array AI providers with models
*/
function datamachine_get_ai_providers_for_react() {
try {
// Use AI HTTP Client library's filters directly
$library_providers = apply_filters( 'chubes_ai_providers', array() );

$providers = array();
foreach ( $library_providers as $key => $provider_info ) {
// Get models for this provider via filter
$models = apply_filters( 'chubes_ai_models', $key );

$providers[ $key ] = array(
'label' => $provider_info['name'] ?? ucfirst( $key ),
'models' => $models,
);
}

return $providers;
} catch ( \Exception $e ) {
do_action(
'datamachine_log',
'error',
'Failed to get AI providers for React',
array(
'error' => $e->getMessage(),
'exception' => $e,
)
);
return array();
}
}

/**
* Get AI tools formatted for React.
*
* Returns only global (non-handler) tools from the unified `datamachine_tools`
* registry. Handler tools are excluded because their definitions are shaped
* by runtime handler config and are only meaningful inside a pipeline
* execution context.
*
* @return array AI tools with configuration status
*/
function datamachine_get_ai_tools_for_react() {
$tool_manager = new \DataMachine\Engine\AI\Tools\ToolManager();
$all_tools = $tool_manager->get_all_tools();

// Filter to only global tools — exclude both per-handler tools (carry
// a 'handler' link) and handler tool registry wrappers.
$global_tools = array_filter(
$all_tools,
function ( $tool_def ) {
if ( ! is_array( $tool_def ) ) {
return false;
}
if ( isset( $tool_def['_handler_callable'] ) ) {
return false;
}
return ! isset( $tool_def['handler'] );
}
);

$tools = array();
foreach ( $global_tools as $tool_id => $tool_def ) {
$tools[ $tool_id ] = array(
'label' => $tool_def['label'] ?? ucfirst( str_replace( '_', ' ', $tool_id ) ),
'description' => $tool_def['description'] ?? '',
'configured' => apply_filters( 'datamachine_tool_configured', false, $tool_id ),
);
}

return $tools;
}

// Auto-register when file loads - achieving complete self-containment
add_action( 'init', __NAMESPACE__ . '\\datamachine_register_pipelines_admin_page_filters' );
38 changes: 2 additions & 36 deletions inc/Core/Admin/Pages/Pipelines/assets/css/chat-input.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* Chat Input Styles
*
* Input area, textarea, and send button.
* Input container only. Textarea and send button are handled by the
* @extrachill/chat library components.
*/

/* ===== INPUT CONTAINER ===== */
Expand All @@ -14,38 +15,3 @@
align-items: flex-end;
flex-shrink: 0;
}

/* ===== TEXTAREA ===== */

.datamachine-chat-input__textarea {
flex: 1;
padding: 8px 12px;
border: 1px solid #ddd;
border-radius: 8px;
font-family: inherit;
font-size: 13px;
line-height: 1.4;
resize: none;
min-height: 36px;
max-height: 120px;
}

.datamachine-chat-input__textarea:focus {
outline: none;
border-color: #007cba;
box-shadow: 0 0 0 1px #007cba;
}

.datamachine-chat-input__textarea:disabled {
background: #f9f9f9;
color: #757575;
}

/* ===== SEND BUTTON ===== */

.datamachine-chat-input__send {
flex-shrink: 0;
min-width: 36px;
height: 36px;
padding: 0;
}
164 changes: 4 additions & 160 deletions inc/Core/Admin/Pages/Pipelines/assets/css/chat-messages.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/**
* Chat Messages Styles
*
* Message list, individual messages, markdown rendering, code blocks,
* typing indicator, and timestamps.
* Message list container only. Individual messages, markdown rendering,
* code blocks, typing indicator, and timestamps are handled by the
* @extrachill/chat library components.
*/

/* ===== MESSAGE LIST ===== */
/* ===== MESSAGE LIST CONTAINER ===== */

.datamachine-chat-messages {
flex: 1;
Expand All @@ -15,160 +16,3 @@
flex-direction: column;
gap: 12px;
}

.datamachine-chat-messages__empty {
color: #757575;
font-size: 13px;
text-align: center;
padding: 20px;
line-height: 1.5;
}

/* ===== INDIVIDUAL MESSAGE ===== */

.datamachine-chat-message {
max-width: 90%;
padding: 10px 14px;
border-radius: 12px;
font-size: 13px;
line-height: 1.5;
word-wrap: break-word;
}

.datamachine-chat-message--user {
background: #007cba;
color: #fff;
margin-left: auto;
border-bottom-right-radius: 4px;
}

.datamachine-chat-message--assistant {
background: #f0f0f0;
color: #1e1e1e;
margin-right: auto;
border-bottom-left-radius: 4px;
}

/* ===== MESSAGE CONTENT & MARKDOWN ===== */

.datamachine-chat-message__content {
word-break: break-word;
overflow-wrap: anywhere;
}

.datamachine-chat-message__content p:first-child {
margin-top: 0;
}

.datamachine-chat-message__content p:last-child {
margin-bottom: 0;
}

.datamachine-chat-message__content h1,
.datamachine-chat-message__content h2,
.datamachine-chat-message__content h3,
.datamachine-chat-message__content h4 {
margin: 12px 0 8px;
font-size: 1.1em;
line-height: 1.3;
}

.datamachine-chat-message__content ul,
.datamachine-chat-message__content ol {
margin: 8px 0;
padding-left: 20px;
}

.datamachine-chat-message__content li {
margin-bottom: 4px;
}

/* ===== CODE BLOCKS ===== */

.datamachine-chat-message__content code {
background: rgba(0, 0, 0, 0.05);
padding: 2px 4px;
border-radius: 4px;
font-size: 0.9em;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
overflow-wrap: anywhere;
}

.datamachine-chat-message--user .datamachine-chat-message__content code {
background: rgba(255, 255, 255, 0.2);
color: #fff;
}

/* ===== TOOL SUMMARY (inline) ===== */

.datamachine-chat-message__tools {
margin-top: 8px;
font-size: 11px;
color: #757575;
font-style: italic;
}

.datamachine-chat-message--user .datamachine-chat-message__tools {
color: rgba(255, 255, 255, 0.7);
}

/* ===== TIMESTAMP ===== */

.datamachine-chat-message__timestamp {
display: none;
font-size: 10px;
color: #999;
margin-top: 4px;
}

.datamachine-chat-message:hover .datamachine-chat-message__timestamp {
display: block;
}

.datamachine-chat-message--user .datamachine-chat-message__timestamp {
color: rgba(255, 255, 255, 0.6);
}

/* ===== TYPING INDICATOR ===== */

.datamachine-chat-messages__typing {
display: flex;
align-items: center;
gap: 4px;
padding: 10px 14px;
background: #f0f0f0;
border-radius: 12px;
border-bottom-left-radius: 4px;
width: fit-content;
}

.datamachine-typing-dot {
width: 8px;
height: 8px;
background: #757575;
border-radius: 50%;
animation: datamachine-typing-bounce 1.4s infinite ease-in-out both;
}

.datamachine-typing-dot:nth-child(1) {
animation-delay: -0.32s;
}

.datamachine-typing-dot:nth-child(2) {
animation-delay: -0.16s;
}

.datamachine-typing-dot:nth-child(3) {
animation-delay: 0s;
}

@keyframes datamachine-typing-bounce {
0%, 80%, 100% {
transform: scale(0.6);
opacity: 0.5;
}
40% {
transform: scale(1);
opacity: 1;
}
}
24 changes: 0 additions & 24 deletions inc/Core/Admin/Pages/Pipelines/assets/css/chat-sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
@import url("chat-messages.css");
@import url("chat-input.css");
@import url("chat-sessions.css");
@import url("chat-tools.css");

/* ===== LAYOUT ===== */

Expand Down Expand Up @@ -81,33 +80,10 @@
position: relative;
}

.datamachine-chat-sidebar__new,
.datamachine-chat-sidebar__copy {
font-size: 12px;
}

/* ===== PROCESSING INDICATOR ===== */

.datamachine-chat-sidebar__processing {
padding: 8px 16px;
background: #f9f9f9;
border-top: 1px solid #eee;
font-size: 12px;
color: #757575;
text-align: center;
flex-shrink: 0;
animation: datamachine-processing-pulse 1.5s ease-in-out infinite;
}

@keyframes datamachine-processing-pulse {
0%, 100% {
opacity: 0.7;
}
50% {
opacity: 1;
}
}

/* ===== RESPONSIVE ===== */

@media (max-width: 960px) {
Expand Down
Loading
Loading