8 Commits

Author SHA1 Message Date
5badaa18fd Merge branch 'main' of 192.168.1.206:roberto/siti-ai-product-content-generator
All checks were successful
Build & Release Plugin / release (push) Successful in 8s
2026-02-06 19:25:12 +00:00
9776c2a8fa chore: fix PHP opening tag formatting in groq-ai-product-text.php 2026-02-06 19:25:08 +00:00
actions-bot
e02d29c49e chore: update manifest.json 2026-02-06 18:47:29 +00:00
5ed94f79d3 chore: bump version to 1.10.0 and enhance model selection functionality
Some checks failed
Build & Release Plugin / release (push) Failing after 10s
2026-02-06 18:47:21 +00:00
actions-bot
ee1873568d chore: update manifest.json 2026-02-01 15:44:21 +00:00
cf0269f421 chore: bump version to 1.9.9
All checks were successful
Build & Release Plugin / release (push) Successful in 10s
2026-02-01 15:44:14 +00:00
a352c53139 chore: add release workflow for plugin build and deployment 2026-02-01 15:43:42 +00:00
github-actions[bot]
b33d92a80e chore: update manifest.json 2026-02-01 04:46:37 +00:00
5 changed files with 83 additions and 206 deletions

View File

@@ -0,0 +1,25 @@
name: Build & Release Plugin
on:
workflow_dispatch:
inputs:
release_notes:
description: "Optionele release-opmerkingen"
required: false
push:
branches: [ main ]
paths:
- 'groq-ai-product-text.php'
- 'includes/**'
- 'assets/**'
- 'languages/**'
jobs:
release:
uses: roberto/ci-workflows/.gitea/workflows/wp-plugin-release.yml@c6393ed47258d6f040ceeed3994b17b7faa3ef23
with:
main_file: groq-ai-product-text.php
slug: siti-ai-product-content-generator
release_body: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release_notes || '' }}
secrets:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}

View File

@@ -1,199 +0,0 @@
name: Build & Release Plugin
on:
workflow_dispatch:
inputs:
release_notes:
description: 'Optionele release-opmerkingen'
required: false
push:
branches:
- main
paths:
- 'groq-ai-product-text.php'
- 'includes/**'
- 'assets/**'
- 'README.md'
- '.github/workflows/release.yml'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Determine plugin version
id: meta
run: |
VERSION=$(grep -E "^\s*\*\s*Version:" -m 1 groq-ai-product-text.php | sed -E 's/.*Version:\s*//')
VERSION=$(echo "$VERSION" | tr -d '\r')
if [ -z "$VERSION" ]; then
echo "::error::Kon pluginversie niet bepalen."
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Genereer manifest.json uit plugin header
run: |
python3 - <<'PY'
import json
import re
with open('groq-ai-product-text.php', 'r', encoding='utf-8') as handle:
content = handle.read()
header_match = re.search(r'/\*\*(.*?)\*/', content, re.S)
header = header_match.group(1) if header_match else ''
def read_field(label: str) -> str:
match = re.search(r'^\s*\*\s*' + re.escape(label) + r'\s*:\s*(.+)$', header, re.M)
return match.group(1).strip() if match else ''
manifest = {
'plugin_name': read_field('Plugin Name'),
'description': read_field('Description'),
'version': read_field('Version'),
'author': read_field('Author'),
'author_url': read_field('Author URI'),
}
with open('manifest.json', 'w', encoding='utf-8') as handle:
json.dump(manifest, handle, ensure_ascii=False, indent=2)
print('manifest.json aangemaakt/bijgewerkt')
PY
- name: Commit & push manifest.json
run: |
if git diff --quiet -- manifest.json; then
echo "manifest.json ongewijzigd; geen commit nodig."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add manifest.json
git commit -m "chore: update manifest.json"
git push
- name: Check if tag exists
id: tagcheck
run: |
TAG="v${{ steps.meta.outputs.version }}"
if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "refs/tags/$TAG$"; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Tag bestaat al workflow afronden
if: steps.tagcheck.outputs.exists == 'true'
run: |
echo "Tag v${{ steps.meta.outputs.version }} bestaat al. Release wordt overgeslagen."
- name: Build distributie-zip
if: steps.tagcheck.outputs.exists == 'false'
id: package
run: |
if ! command -v zip >/dev/null 2>&1; then
apt-get update -y
apt-get install -y zip
fi
VERSION="${{ steps.meta.outputs.version }}"
SLUG="siti-ai-product-content-generator"
BUILD_ROOT="$RUNNER_TEMP/build"
DEST_DIR="$BUILD_ROOT/$SLUG"
mkdir -p "$DEST_DIR"
tar -cf - \
--exclude='.git' \
--exclude='.github' \
--exclude='docker' \
--exclude='docs' \
--exclude='dist' \
--exclude='docker-compose.yml' \
--exclude='PLAN.md' \
. | tar -xf - -C "$DEST_DIR"
mkdir -p dist
ZIP_PATH="dist/${SLUG}-${VERSION}.zip"
(cd "$BUILD_ROOT" && zip -r "$GITHUB_WORKSPACE/$ZIP_PATH" "$SLUG")
echo "asset_path=$ZIP_PATH" >> "$GITHUB_OUTPUT"
echo "asset_name=${SLUG}-${VERSION}.zip" >> "$GITHUB_OUTPUT"
- name: Maak Gitea release
if: steps.tagcheck.outputs.exists == 'false'
env:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
RELEASE_SERVER_URL: ${{ vars.RELEASE_SERVER_URL }}
RELEASE_REPOSITORY: ${{ vars.RELEASE_REPOSITORY }}
run: |
VERSION="${{ steps.meta.outputs.version }}"
TAG="v$VERSION"
ASSET_PATH="${{ steps.package.outputs.asset_path }}"
ASSET_NAME="${{ steps.package.outputs.asset_name }}"
if [ -z "$RELEASE_TOKEN" ]; then
echo "::error::RELEASE_TOKEN ontbreekt. Voeg deze secret toe om releases te kunnen maken."
exit 1
fi
SERVER_URL="${RELEASE_SERVER_URL:-${GITHUB_SERVER_URL}}"
REPO="${RELEASE_REPOSITORY:-${GITHUB_REPOSITORY}}"
if [ -z "$SERVER_URL" ] || [ -z "$REPO" ]; then
echo "::error::Kan server of repository niet bepalen. Stel RELEASE_SERVER_URL en RELEASE_REPOSITORY in."
exit 1
fi
API_URL="${SERVER_URL%/}/api/v1"
export TAG
python3 - <<'PY'
import json
import os
payload = {
"tag_name": os.environ["TAG"],
"name": f"Siti AI Product Teksten {os.environ['TAG']}",
"body": f"Automatische release op basis van versie {os.environ['TAG'][1:]}",
"target_commitish": os.environ.get("GITHUB_SHA") or os.environ.get("GITEA_SHA", ""),
}
with open("release.json", "w", encoding="utf-8") as handle:
json.dump(payload, handle, ensure_ascii=False)
PY
curl -sS -X POST "$API_URL/repos/$REPO/releases" \
-H "Authorization: token $RELEASE_TOKEN" \
-H "Content-Type: application/json" \
-d @release.json \
-o release-response.json
RELEASE_ID=$(python3 - <<'PY'
import json
with open('release-response.json', 'r', encoding='utf-8') as handle:
data = json.load(handle)
print(data.get('id', ''))
PY
)
if [ -z "$RELEASE_ID" ]; then
echo "::error::Kon release-ID niet bepalen. Response: $(cat release-response.json)"
exit 1
fi
curl -sS -X POST "$API_URL/repos/$REPO/releases/$RELEASE_ID/assets?name=$ASSET_NAME" \
-H "Authorization: token $RELEASE_TOKEN" \
-H "Content-Type: application/zip" \
--data-binary "@$ASSET_PATH"

View File

@@ -1,8 +1,8 @@
<?php
<?php
/**
* Plugin Name: SitiAI Product Teksten
* Description: Genereer productteksten met diverse AI-aanbieders rechtstreeks vanuit WooCommerce.
* Version: 1.9.8
* Version: 1.10.0
* Author: Roberto Guagliardo | SitiWeb
* Author URI: https://sitiweb.nl/
* Text Domain: siti-ai-product-content-generator

View File

@@ -181,6 +181,7 @@ class Groq_AI_Product_Text_Settings_Page extends Groq_AI_Admin_Base {
'attributes' => [
'id' => 'groq-ai-model-select',
],
'current_provider' => isset( $settings['provider'] ) ? $settings['provider'] : '',
]
);
@@ -569,15 +570,50 @@ class Groq_AI_Product_Text_Settings_Page extends Groq_AI_Admin_Base {
<?php
}
private function render_model_select_field( $field_args ) {
public function render_model_select_field( $field_args ) {
$name = isset( $field_args['name'] ) ? $field_args['name'] : '';
$id = isset( $field_args['id'] ) && '' !== $field_args['id'] ? $field_args['id'] : 'groq-ai-model-select';
$current = isset( $field_args['value'] ) ? (string) $field_args['value'] : '';
$placeholder = __( 'Selecteer eerst een aanbieder', GROQ_AI_PRODUCT_TEXT_DOMAIN );
$current_provider = isset( $field_args['current_provider'] ) ? sanitize_key( (string) $field_args['current_provider'] ) : '';
$provider = '' !== $current_provider ? $this->provider_manager->get_provider( $current_provider ) : null;
$models = [];
if ( $provider ) {
$models = $this->prepare_models_list_for_provider( $current_provider, $this->plugin->get_cached_models_for_provider( $current_provider ) );
if ( empty( $models ) ) {
$models = $this->prepare_models_list_for_provider( $current_provider, $provider->get_available_models() );
}
$placeholder = __( 'Selecteer een model', GROQ_AI_PRODUCT_TEXT_DOMAIN );
} elseif ( '' !== $current_provider ) {
$placeholder = __( 'Geen modellen gevonden. Gebruik "Live modellen ophalen".', GROQ_AI_PRODUCT_TEXT_DOMAIN );
}
?>
<div class="groq-ai-model-field">
<select id="<?php echo esc_attr( $id ); ?>" name="<?php echo esc_attr( $name ); ?>" data-current-model="<?php echo esc_attr( $current ); ?>">
<option value="" selected="selected"><?php echo esc_html( $placeholder ); ?></option>
<option value=""><?php echo esc_html( $placeholder ); ?></option>
<?php
if ( ! empty( $models ) ) :
$has_current = in_array( $current, $models, true );
foreach ( $models as $model ) :
?>
<option value="<?php echo esc_attr( $model ); ?>" <?php selected( $current, $model ); ?>><?php echo esc_html( $model ); ?></option>
<?php
endforeach;
if ( $current && ! $has_current ) :
?>
<option value="<?php echo esc_attr( $current ); ?>" selected="selected"><?php echo esc_html( $current ); ?></option>
<?php
endif;
elseif ( $current ) :
?>
<option value="<?php echo esc_attr( $current ); ?>" selected="selected"><?php echo esc_html( $current ); ?></option>
<?php
endif;
?>
</select>
</div>
<button type="button" class="button" id="groq-ai-refresh-models"><?php esc_html_e( 'Live modellen ophalen', GROQ_AI_PRODUCT_TEXT_DOMAIN ); ?></button>
@@ -865,8 +901,11 @@ class Groq_AI_Product_Text_Settings_Page extends Groq_AI_Admin_Base {
foreach ( $this->provider_manager->get_providers() as $provider ) {
$provider_key = $provider->get_key();
$cached_models = $this->plugin->get_cached_models_for_provider( $provider_key );
$cached_models = Groq_AI_Model_Exclusions::filter_models( $provider_key, $cached_models );
$cached_models = $this->prepare_models_list_for_provider( $provider_key, $this->plugin->get_cached_models_for_provider( $provider_key ) );
if ( empty( $cached_models ) ) {
$cached_models = $this->prepare_models_list_for_provider( $provider_key, $provider->get_available_models() );
}
$data['providers'][ $provider_key ] = [
'default_label' => sprintf( __( 'Gebruik standaardmodel (%s)', GROQ_AI_PRODUCT_TEXT_DOMAIN ), $provider->get_default_model() ),
'models' => $cached_models,
@@ -878,6 +917,18 @@ class Groq_AI_Product_Text_Settings_Page extends Groq_AI_Admin_Base {
wp_localize_script( 'groq-ai-settings', 'GroqAISettingsData', $data );
}
private function prepare_models_list_for_provider( $provider_key, $models ) {
$list = Groq_AI_Model_Exclusions::filter_models( $provider_key, $models );
if ( empty( $list ) ) {
return [];
}
sort( $list, SORT_NATURAL | SORT_FLAG_CASE );
return $list;
}
public function handle_google_oauth_start() {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( esc_html__( 'Je hebt geen toestemming om deze actie uit te voeren.', GROQ_AI_PRODUCT_TEXT_DOMAIN ), '', [ 'response' => 403 ] );

View File

@@ -1,7 +1,7 @@
{
"plugin_name": "SitiAI Product Teksten",
"description": "Genereer productteksten met diverse AI-aanbieders rechtstreeks vanuit WooCommerce.",
"version": "1.9.7",
"version": "1.10.0",
"author": "Roberto Guagliardo | SitiWeb",
"author_url": "https://sitiweb.nl/"
}