This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: LLMServer Integration | |
Plugin URI: https://example.com | |
Description: Integrates a custom LLM server ("LLMServer") into AI Engine as a new engine, similarly to how Ollama is integrated. | |
Version: 1.0.0 | |
Author: Your Name | |
Author URI: https://example.com | |
License: GPLv2 or later | |
Text Domain: llmserver-integration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import getpass | |
import json | |
import urllib.parse | |
import urllib.request | |
def main(): | |
# 1. Prompt for API key | |
api_key = getpass.getpass("Please enter your OpenAI API key: ").strip() | |
if not api_key: |
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 10.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
question,reply | |
"Where is the setting of the story ""The Alley""?","The story is set in the little seaside town." | |
"What was the cat's fur color in ""The Alley""?","The cat had shiny black fur." | |
"What is the cat described as being curious about in ""The Alley""?","The cat is curious about a mysterious, dark alley." | |
"What celestial body provides lighting in the story?","The moon provides the soft glow lighting in the story." | |
"Where was the cat standing when he paused in the alley?","The cat paused under the moonlight, his shadow stretching across the cobblestone street." | |
"What was the local legend mentioned in ""The Alley""?","The local legend mentioned a magical treasure that could change someone's life." | |
"How did the cat sense the magic in the air?","The cat's whiskers twitched as he sensed the magic in the air." | |
"What did the cat discover in the dark corner of the alley?","The cat discovered a small, beautifully carved box half-covered by ivy." | |
"What was inside the beautifully carved box?","Inside the box was |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"messages": [ | |
{ | |
"role": "system", | |
"content": "You are Chihiro, an AI Assistant." | |
}, | |
{ | |
"role": "user", | |
"content": "Where is the setting of the story \"The Alley\"?" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#region Functions Definitions + Callable Functions | |
function define_userInfo() { | |
return Meow_MWAI_Query_Function::fromJson( [ | |
'id' => 'userInfo', // Anything you like! | |
'type' => 'manual', // You can set it to your add-on name (if null, it will be 'manual') | |
'name' => 'getCurrentUserInfo', // Important: What's the name of the function? | |
'desc' => 'Get the current user information.' // Important: What the function does? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Adding action hooks for Media Cleaner plugin | |
add_action( 'wpmc_scan_once', 'wpmc_scan_once_PLUGIN_NAME', 10, 0 ); | |
add_action( 'wpmc_scan_post', 'wpmc_scan_html_PLUGIN_NAME', 10, 2 ); | |
add_action( 'wpmc_scan_postmeta', 'wpmc_scan_postmeta_PLUGIN_NAME', 10, 2 ); | |
/** | |
* Runs once at the beginning of the scan. | |
* Can be used to check images usage in general settings, in a theme, like a favicon, etc. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"additionalModelInfo": {"type": "string", "description": "Information about the ethnicity and other facets of models in a model-released image."}, | |
"aperture": {"type": "string", "description": "The aperture (for example, 'f/2.8')."}, | |
"artist": {"type": "string", "description": "The artist's name."}, | |
"artworksShown": {"type": "table", "description": "A set of metadata about artwork or an object in the image. Each element in the table is a structure named ArtworkOrObjectDetails, as defined in the IPTC Extension spec."}, | |
"brightnessValue": {"type": "string", "description": "The brightness value."}, | |
"cameraMake": {"type": "string", "description": "The camera manufacturer."}, | |
"cameraModel": {"type": "string", "description": "The camera model."}, | |
"cameraSerialNumber": {"type": "string", "description": "The camera serial number."}, | |
"caption": {"type": "string", "description": "The caption for photo."}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// The purpose of the mwai_stats_credits filter is to alter the number of credits (which can represent a certain number of queries or amount of dollars) allowed in total for a specific user. | |
// In this implementation below, we'll attribute the number of credits based on the role the user has. | |
add_filter( 'mwai_stats_credits', function ( $credits, $userId ) { | |
// Retrieve user data | |
$user = get_userdata( $userId ); | |
// Assign the initial credits provided as argument |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Various links | |
// https://serverfault.com/questions/488767/how-do-i-enable-php-s-flush-with-nginxphp-fpm | |
// https://stackoverflow.com/questions/72394213/nginx-configuration-for-server-sent-event | |
// https://serverfault.com/questions/801628/for-server-sent-events-sse-what-nginx-proxy-configuration-is-appropriate | |
// https://qiita.com/okumurakengo/items/cbe6b3717b95944083a1 (in Japanese) | |
// If '?SSE' is set, send Server-Sent events, otherwise we'll display the page. | |
if ( isset( $_GET['SSE'] ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( "mwai_context_search", 'my_web_search', 10, 3 ); | |
function my_web_search( $context, $query, $options = [] ) { | |
// If the context is already provided, return it as is. | |
if ( ! empty( $context ) ) { | |
return $context; | |
} |
NewerOlder