Banner
Overzicht website ontwikkeling

Volg mijn reis als ADHDer. Ik beloof je dat het niet saai zal zijn!

Menu





Overzicht website ontwikkeling

Volg hoe de site zich langzaam aan verder ontwikkeld tot een uniek presentatie platform. Op dit moment draait de site op een skeleton file met css van het W3 consortium, php en een handjevol zelfgeschreven functies.

Inmiddels is daar Markdown aan toegevoegd met veel aanvullende functies die paginas nog prettiger te lezen maakt. Eenvoudiger bookmarks te plaatsen via het 🔗 symbool bij titles tot en met een inhoudsopgave van de artikelen.

Markdown is daarmee een van de beste markup methodes die je kunt bedenken.

Laatste nieuws

Geplanned

Gedaan

Website Tools

Resources

Text

Graphics

Hashtags: #development #php #website #history #tools #todo

/*
* Function: __construct
* Input   : not applicable
* Output  : none
* Purpose : sets initial values on instantiating class 
* 
* Remarks:
* 
* This is a great place to set your initial values like your
* own language or the model to work with.
*/

function __construct(){
	$this->apiKey = getenv('STRAICO_APIKEY');
	$this->arUser = $this->apiUser();
	$this->arModels = $this->apiModels();
	$this->aiModel = 'anthropic/claude-3-haiku:beta';
	$this->clsVersion = '1.1.0';
    $this->aiMarkup = "/nUse text/plain as markup for your answer.\n";
	$this->aiLanguage = "/nUse English as language for your answer.\n";
	$this->aiTone = "/nUse a neutral tone for your answer.\n";
	$this->aiTarget = "/nTarget anyone for your answer.\n";
}
/*
* Function: apiCompletion($aiMessage)
* Input   : $aiMessage - is the prompt
* Output  : returns response content
* Purpose : Complete an API call with the prompt info 
*
* Remarks:
* 
* Returns the response content. At later time this will be
* adjusted to reflect the other information
*/

public function apiCompletion($aiMessage){
	 
$endPoint = 'https://api.straico.com/v0/prompt/completion';
$httpMethod = 'POST';

  if( strpos($aiMessage,'_PAGE_') ){
    $aiMessage = str_replace('_PAGE_',$this->webPage,$aiMessage);
  }

$aiMessage .= $this->aiLanguage .
              $this->aiTone .
              $this->aiTarget .
			  $this->aiMarkup;

$data = http_build_query(array('model' => $this->aiModel,
                               'message' => $aiMessage));

$options = array(
    'http' => array(
	'header' => "Authorization: Bearer ".$this->apiKey."\r\n" .
	"Content-Type: application/x-www-form-urlencoded\r\n",
	'method' => $httpMethod,
	'content' => $data
    )
);


$context = stream_context_create($options);

$result = file_get_contents($endPoint, false, $context);

$arOutput = json_decode($result, JSON_OBJECT_AS_ARRAY);

return $arOutput['data']['completion']['choices'][0]['message']['content'];

}
/*
* Function: agentFactcheck($input)
* Input   : a rumor, news, anything you want to check
* Output  : returns a fouded opinion
* Purpose : check if the input has any merit 
* 
* Remarks:
* 
* Private function used by $this->userPrompt()
* Choose your llm wisely
* TODO: output format choice
*/
private function agentFactcheck($input){
	
	$fact = substr($input,11);
	
	$aiMessage = 'You are knowledgeable on conspiracy theories, latest news, disinformation and propaganda. 

You use this knowledge to check the {{information}} handed to you by the user.

You answer with a correct and elaborate response to:

"'.$fact.'".

You will educate the user on the source of the info.

You will then explain how reliable it is. ';

	    $apiOutput=$this->apiCompletion($aiMessage);
	    echo "\n$apiOutput\n";
	
}




Aanbevolen links

Impuls en Woortblind
ADHD Cafe Den Haag

Bedel Tikkie

Tikkie QR