Skip to content

Commit efc88da

Browse files
release(minor): version 1.1.0
- Initial version.
1 parent ab68396 commit efc88da

37 files changed

+289
-277
lines changed

.github/workflows/deploy.yml

+9-29
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ jobs:
1212
- name: Get the version
1313
id: get_version
1414
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
15+
- name: Add SSH Key
16+
run: |
17+
mkdir $HOME/.ssh
18+
echo "$SSH_KEY" > "$HOME/.ssh/key"
19+
chmod 600 "$HOME/.ssh/key"
1520
- name: Install composer deps
1621
run: composer install --no-dev --prefer-dist --no-progress --no-suggest
1722
- name: Install npm deps
@@ -20,33 +25,8 @@ jobs:
2025
run: npm run build
2126
- name: Build zip
2227
run: npm run dist
23-
- name: Upload Latest Version to S3
24-
uses: jakejarvis/s3-sync-action@master
25-
with:
26-
args: --acl public-read --follow-symlinks --delete
28+
- name: WordPress Plugin Deploy
29+
uses: 10up/action-wordpress-plugin-deploy@master
2730
env:
28-
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_DOWNLOADS }}
29-
AWS_ACCESS_KEY_ID: ${{ secrets.S3_DOWNLOADS_AWS_ACCESS_KEY_ID }}
30-
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DOWNLOADS_AWS_SECRET_ACCESS_KEY }}
31-
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1
32-
SOURCE_DIR: 'artifact' # optional: defaults to entire repository
33-
DEST_DIR: ${{ secrets.S3_AWS_PRODUCTS_FOLDER }}/hyve-lite/latest
34-
- name: Upload Tagged Version to S3
35-
uses: jakejarvis/s3-sync-action@master
36-
with:
37-
args: --acl public-read --follow-symlinks --delete
38-
env:
39-
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_DOWNLOADS }}
40-
AWS_ACCESS_KEY_ID: ${{ secrets.S3_DOWNLOADS_AWS_ACCESS_KEY_ID }}
41-
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DOWNLOADS_AWS_SECRET_ACCESS_KEY }}
42-
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1
43-
SOURCE_DIR: 'artifact' # optional: defaults to entire repository
44-
DEST_DIR: ${{ secrets.S3_AWS_PRODUCTS_FOLDER }}/hyve-lite/$BUILD_VERSION
45-
- name: Send update to the store
46-
env:
47-
PRODUCT_ID: ${{ secrets.THEMEISLE_ID }}
48-
AUTH_TOKEN: ${{ secrets.THEMEISLE_STORE_AUTH }}
49-
STORE_URL: ${{ secrets.THEMEISLE_STORE_URL }}
50-
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
51-
BUILD_VERSION: ${{ steps.get_version.outputs.VERSION }}
52-
uses: Codeinwp/action-store-release@main
31+
SVN_PASSWORD: ${{ secrets.SVN_THEMEISLE_PASSWORD }}
32+
SVN_USERNAME: ${{ secrets.SVN_THEMEISLE_USERNAME }}

.wordpress-org/screenshot-01.png

142 KB
Loading

.wordpress-org/screenshot-02.png

174 KB
Loading

.wordpress-org/screenshot-03.png

244 KB
Loading

.wordpress-org/screenshot-04.png

227 KB
Loading

Gruntfile.js

+8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ module.exports = function( grunt ) {
3030
flags: ''
3131
},
3232
src: [ 'hyve-lite.php' ]
33+
},
34+
readmetxt: {
35+
options: {
36+
prefix: 'Stable tag:\\s*'
37+
},
38+
src: [
39+
'readme.txt'
40+
]
3341
}
3442
}
3543
}

artifact/hyve-lite.zip

1.09 KB
Binary file not shown.

inc/API.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public function update_settings( $request ) {
226226
}
227227

228228
if ( empty( $updated ) ) {
229-
return rest_ensure_response( array( 'error' => __( 'No settings to update.', 'hyve' ) ) );
229+
return rest_ensure_response( array( 'error' => __( 'No settings to update.', 'hyve-lite' ) ) );
230230
}
231231

232232
$validation = apply_filters(
@@ -267,7 +267,7 @@ function ( $carry, $item ) {
267267
return rest_ensure_response(
268268
array(
269269
// translators: %s: option key.
270-
'error' => sprintf( __( 'Invalid value: %s', 'hyve' ), $key ),
270+
'error' => sprintf( __( 'Invalid value: %s', 'hyve-lite' ), $key ),
271271
)
272272
);
273273
}
@@ -290,7 +290,7 @@ function ( $carry, $item ) {
290290

291291
update_option( 'hyve_settings', $settings );
292292

293-
return rest_ensure_response( __( 'Settings updated.', 'hyve' ) );
293+
return rest_ensure_response( __( 'Settings updated.', 'hyve-lite' ) );
294294
}
295295

296296
/**
@@ -426,7 +426,7 @@ public function add_data( $request ) {
426426

427427
return rest_ensure_response(
428428
array(
429-
'error' => __( 'The content failed moderation policies.', 'hyve' ),
429+
'error' => __( 'The content failed moderation policies.', 'hyve-lite' ),
430430
'code' => 'content_failed_moderation',
431431
'review' => $moderation,
432432
)
@@ -555,7 +555,7 @@ function ( $message ) use ( $run_id ) {
555555
$message = json_decode( $message, true );
556556

557557
if ( json_last_error() !== JSON_ERROR_NONE ) {
558-
return rest_ensure_response( array( 'error' => __( 'No messages found.', 'hyve' ) ) );
558+
return rest_ensure_response( array( 'error' => __( 'No messages found.', 'hyve-lite' ) ) );
559559
}
560560

561561
$settings = Main::get_settings();
@@ -586,7 +586,7 @@ public function send_chat( $request ) {
586586
$moderation = $this->moderate( $message );
587587

588588
if ( true !== $moderation ) {
589-
return rest_ensure_response( array( 'error' => __( 'Message was flagged.', 'hyve' ) ) );
589+
return rest_ensure_response( array( 'error' => __( 'Message was flagged.', 'hyve-lite' ) ) );
590590
}
591591

592592
$openai = new OpenAI();
@@ -595,7 +595,7 @@ public function send_chat( $request ) {
595595
$message_vector = $message_vector->embedding;
596596

597597
if ( is_wp_error( $message_vector ) ) {
598-
return rest_ensure_response( array( 'error' => __( 'No embeddings found.', 'hyve' ) ) );
598+
return rest_ensure_response( array( 'error' => __( 'No embeddings found.', 'hyve-lite' ) ) );
599599
}
600600

601601
$hash = md5( strtolower( $message ) );

inc/BaseAPI.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public function __construct() {
5050
$this->table = new DB_Table();
5151

5252
$this->errors = array(
53-
'invalid_api_key' => __( 'Incorrect API key provided.', 'hyve' ),
54-
'missing_scope' => __( ' You have insufficient permissions for this operation.', 'hyve' ),
53+
'invalid_api_key' => __( 'Incorrect API key provided.', 'hyve-lite' ),
54+
'missing_scope' => __( ' You have insufficient permissions for this operation.', 'hyve-lite' ),
5555
);
5656
}
5757

inc/DB_Table.php

+3-7
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function create_table() {
9595
public function table_exists() {
9696
global $wpdb;
9797
$table = sanitize_text_field( $this->table_name );
98-
return $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) ) === $table; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
98+
return $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) ) === $table;
9999
}
100100

101101
/**
@@ -231,9 +231,7 @@ public function get_by_status( $status, $limit = 500 ) {
231231
return $cache;
232232
}
233233

234-
$query = $wpdb->prepare( "SELECT * FROM {$this->table_name} WHERE post_status = %s LIMIT %d", $status, $limit ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
235-
236-
$results = $wpdb->get_results( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
234+
$results = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM %i WHERE post_status = %s LIMIT %d', $this->table_name, $status, $limit ) );
237235

238236
if ( 'scheduled' !== $status ) {
239237
$this->set_cache( 'entries_' . $status, $results );
@@ -292,9 +290,7 @@ public function get_count() {
292290

293291
global $wpdb;
294292

295-
$query = "SELECT COUNT(*) FROM {$this->table_name}";
296-
297-
$count = $wpdb->get_var( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
293+
$count = $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(*) FROM %i', $this->table_name ) );
298294

299295
$this->set_cache( 'entries_count', $count );
300296

inc/Main.php

+11-23
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public function __construct() {
6868
*/
6969
public function register_menu_page() {
7070
$page_hook_suffix = add_menu_page(
71-
__( 'Hyve', 'hyve' ),
72-
__( 'Hyve', 'hyve' ),
71+
__( 'Hyve', 'hyve-lite' ),
72+
__( 'Hyve', 'hyve-lite' ),
7373
'manage_options',
7474
'hyve',
7575
array( $this, 'menu_page' ),
@@ -118,7 +118,7 @@ public function enqueue_options_assets() {
118118
true
119119
);
120120

121-
wp_set_script_translations( 'hyve-lite-scripts', 'hyve' );
121+
wp_set_script_translations( 'hyve-lite-scripts', 'hyve-lite' );
122122

123123
$post_types = get_post_types( array( 'public' => true ), 'objects' );
124124
$post_types_for_js = array();
@@ -170,8 +170,8 @@ public static function get_default_settings() {
170170
array(
171171
'api_key' => '',
172172
'chat_enabled' => true,
173-
'welcome_message' => __( 'Hello! How can I help you today?', 'hyve' ),
174-
'default_message' => __( 'Sorry, I\'m not able to help with that.', 'hyve' ),
173+
'welcome_message' => __( 'Hello! How can I help you today?', 'hyve-lite' ),
174+
'default_message' => __( 'Sorry, I\'m not able to help with that.', 'hyve-lite' ),
175175
'temperature' => 1,
176176
'top_p' => 1,
177177
'moderation_threshold' => array(
@@ -187,7 +187,7 @@ public static function get_default_settings() {
187187
'harassment/threatening' => 60,
188188
'violence' => 70,
189189
),
190-
),
190+
)
191191
);
192192
}
193193

@@ -228,7 +228,7 @@ public function enqueue_assets() {
228228
true
229229
);
230230

231-
wp_set_script_translations( 'hyve-lite-scripts', 'hyve' );
231+
wp_set_script_translations( 'hyve-lite-scripts', 'hyve-lite' );
232232

233233
$settings = self::get_settings();
234234

@@ -245,7 +245,7 @@ public function enqueue_assets() {
245245
),
246246
'welcome' => $settings['welcome_message'] ?? '',
247247
'isEnabled' => $settings['chat_enabled'],
248-
),
248+
)
249249
)
250250
);
251251

@@ -262,21 +262,9 @@ public function enqueue_assets() {
262262
return;
263263
}
264264

265-
add_action(
266-
'wp_footer',
267-
function () {
268-
?>
269-
<script>
270-
document.addEventListener('DOMContentLoaded', function() {
271-
const credits = document.createElement('div');
272-
credits.className = 'hyve-credits';
273-
credits.innerHTML = '<a href="https://themeisle.com/plugins/hyve/" target="_blank">Powered by Hyve</a>';
274-
document.querySelector( '.hyve-input-box' ).before( credits );
275-
});
276-
</script>
277-
<?php
278-
},
279-
99
265+
wp_add_inline_script(
266+
'hyve-lite-scripts',
267+
'document.addEventListener("DOMContentLoaded", function() { const c = document.createElement("div"); c.className = "hyve-credits"; c.innerHTML = "<a href=\"https://themeisle.com/plugins/hyve/\" target=\"_blank\">Powered by Hyve</a>"; document.querySelector( ".hyve-input-box" ).before( c ); });'
280268
);
281269
}
282270

inc/OpenAI.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function create_assistant() {
9999
return $response->id;
100100
}
101101

102-
return new \WP_Error( 'unknown_error', __( 'An error occurred while creating the assistant.', 'hyve' ) );
102+
return new \WP_Error( 'unknown_error', __( 'An error occurred while creating the assistant.', 'hyve-lite' ) );
103103
}
104104

105105
/**
@@ -201,7 +201,7 @@ public function create_embeddings( $content, $model = 'text-embedding-3-small' )
201201
return $response->data;
202202
}
203203

204-
return new \WP_Error( 'unknown_error', __( 'An error occurred while creating the embeddings.', 'hyve' ) );
204+
return new \WP_Error( 'unknown_error', __( 'An error occurred while creating the embeddings.', 'hyve-lite' ) );
205205
}
206206

207207
/**
@@ -225,7 +225,7 @@ public function create_thread( $params = array() ) {
225225
return $response->id;
226226
}
227227

228-
return new \WP_Error( 'unknown_error', __( 'An error occurred while creating the thread.', 'hyve' ) );
228+
return new \WP_Error( 'unknown_error', __( 'An error occurred while creating the thread.', 'hyve-lite' ) );
229229
}
230230

231231
/**
@@ -254,7 +254,7 @@ public function send_message( $message, $thread, $role = 'assistant' ) {
254254
return true;
255255
}
256256

257-
return new \WP_Error( 'unknown_error', __( 'An error occurred while sending the message.', 'hyve' ) );
257+
return new \WP_Error( 'unknown_error', __( 'An error occurred while sending the message.', 'hyve-lite' ) );
258258
}
259259

260260
/**
@@ -286,7 +286,7 @@ public function create_run( $messages, $thread ) {
286286
}
287287

288288
if ( ! isset( $response->id ) || ( isset( $response->status ) && 'queued' !== $response->status ) ) {
289-
return new \WP_Error( 'unknown_error', __( 'An error occurred while creating the run.', 'hyve' ) );
289+
return new \WP_Error( 'unknown_error', __( 'An error occurred while creating the run.', 'hyve-lite' ) );
290290
}
291291

292292
return $response->id;
@@ -311,7 +311,7 @@ public function get_status( $run_id, $thread ) {
311311
return $response->status;
312312
}
313313

314-
return new \WP_Error( 'unknown_error', __( 'An error occurred while getting the run status.', 'hyve' ) );
314+
return new \WP_Error( 'unknown_error', __( 'An error occurred while getting the run status.', 'hyve-lite' ) );
315315
}
316316

317317
/**
@@ -332,7 +332,7 @@ public function get_messages( $thread ) {
332332
return $response->data;
333333
}
334334

335-
return new \WP_Error( 'unknown_error', __( 'An error occurred while getting the messages.', 'hyve' ) );
335+
return new \WP_Error( 'unknown_error', __( 'An error occurred while getting the messages.', 'hyve-lite' ) );
336336
}
337337

338338
/**
@@ -430,7 +430,7 @@ private function request( $endpoint, $params = array(), $method = 'POST' ) {
430430
return new \WP_Error( isset( $body->error->code ) ? $body->error->code : 'unknown_error', $body->error->message );
431431
}
432432

433-
return new \WP_Error( 'unknown_error', __( 'An error occurred while processing the request.', 'hyve' ) );
433+
return new \WP_Error( 'unknown_error', __( 'An error occurred while processing the request.', 'hyve-lite' ) );
434434
}
435435

436436
return $body;

inc/Threads.php

+16-17
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@ public function __construct() {
2727
*/
2828
public function register() {
2929
$labels = array(
30-
'name' => _x( 'Threads', 'post type general name', 'hyve' ),
31-
'singular_name' => _x( 'Thread', 'post type singular name', 'hyve' ),
32-
'menu_name' => _x( 'Threads', 'admin menu', 'hyve' ),
33-
'name_admin_bar' => _x( 'Thread', 'add new on admin bar', 'hyve' ),
34-
'add_new' => _x( 'Add New', 'Thread', 'hyve' ),
35-
'add_new_item' => __( 'Add New Thread', 'hyve' ),
36-
'new_item' => __( 'New Thread', 'hyve' ),
37-
'edit_item' => __( 'Edit Thread', 'hyve' ),
38-
'view_item' => __( 'View Thread', 'hyve' ),
39-
'all_items' => __( 'All Threads', 'hyve' ),
40-
'search_items' => __( 'Search Threads', 'hyve' ),
41-
'parent_item_colon' => __( 'Parent Thread:', 'hyve' ),
42-
'not_found' => __( 'No Threads found.', 'hyve' ),
43-
'not_found_in_trash' => __( 'No Threads found in Trash.', 'hyve' ),
30+
'name' => _x( 'Threads', 'post type general name', 'hyve-lite' ),
31+
'singular_name' => _x( 'Thread', 'post type singular name', 'hyve-lite' ),
32+
'menu_name' => _x( 'Threads', 'admin menu', 'hyve-lite' ),
33+
'name_admin_bar' => _x( 'Thread', 'add new on admin bar', 'hyve-lite' ),
34+
'add_new' => _x( 'Add New', 'Thread', 'hyve-lite' ),
35+
'add_new_item' => __( 'Add New Thread', 'hyve-lite' ),
36+
'new_item' => __( 'New Thread', 'hyve-lite' ),
37+
'edit_item' => __( 'Edit Thread', 'hyve-lite' ),
38+
'view_item' => __( 'View Thread', 'hyve-lite' ),
39+
'all_items' => __( 'All Threads', 'hyve-lite' ),
40+
'search_items' => __( 'Search Threads', 'hyve-lite' ),
41+
'parent_item_colon' => __( 'Parent Thread:', 'hyve-lite' ),
42+
'not_found' => __( 'No Threads found.', 'hyve-lite' ),
43+
'not_found_in_trash' => __( 'No Threads found in Trash.', 'hyve-lite' ),
4444
);
4545

4646
$args = array(
4747
'labels' => $labels,
48-
'description' => __( 'Threads.', 'hyve' ),
48+
'description' => __( 'Threads.', 'hyve-lite' ),
4949
'public' => false,
5050
'publicly_queryable' => false,
5151
'show_ui' => false,
@@ -206,8 +206,7 @@ public static function get_messages_count() {
206206
if ( ! $messages ) {
207207
global $wpdb;
208208

209-
$query = "SELECT SUM( CAST( meta_value AS UNSIGNED ) ) FROM {$wpdb->postmeta} WHERE meta_key = '_hyve_thread_count'";
210-
$messages = $wpdb->get_var( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
209+
$messages = $wpdb->get_var( $wpdb->prepare( "SELECT SUM( CAST( meta_value AS UNSIGNED ) ) FROM {$wpdb->postmeta} WHERE meta_key = %s", '_hyve_thread_count' ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
211210

212211
if ( ! $messages ) {
213212
$messages = 0;

0 commit comments

Comments
 (0)