Files
EasySoft-ZenTaoPMS/module/ai/config.php
T

77 lines
5.3 KiB
PHP

<?php
$config->ai->openai = new stdclass();
$config->ai->openai->api = new stdclass();
$config->ai->openai->api->version = 'v1'; // OpenAI API version, required.
$config->ai->openai->api->format = 'https://api.openai.com/%s/%s'; // OpenAI API format, args: API version, API name.
$config->ai->openai->api->authFormat = 'Authorization: Bearer %s'; // OpenAI API auth header format.
$config->ai->openai->api->methods = array('function' => 'chat/completions', 'chat' => 'chat/completions', 'completion' => 'completions', 'edit' => 'edits');
$config->ai->openai->params = new stdclass();
$config->ai->openai->params->chat = new stdclass();
$config->ai->openai->params->function = new stdclass();
$config->ai->openai->params->completion = new stdclass();
$config->ai->openai->params->edit = new stdclass();
$config->ai->openai->params->chat->required = array('messages');
$config->ai->openai->params->chat->optional = array('max_tokens', 'temperature', 'top_p', 'n', 'stream', 'stop', 'presence_penalty', 'frequency_penalty', 'logit_bias', 'user');
$config->ai->openai->params->function->required = array('messages', 'functions', 'function_call');
$config->ai->openai->params->function->optional = array('max_tokens', 'temperature', 'top_p', 'n', 'stream', 'stop', 'presence_penalty', 'frequency_penalty', 'logit_bias', 'user');
$config->ai->openai->params->completion->required = array('prompt', 'max_tokens');
$config->ai->openai->params->completion->optional = array('suffix', 'temperature', 'top_p', 'n', 'stream', 'logprobs', 'echo', 'stop', 'presence_penalty', 'frequency_penalty', 'best_of', 'logit_bias', 'user');
$config->ai->openai->params->edit->required = array('input', 'instruction');
$config->ai->openai->params->edit->optional = array('temperature', 'top_p', 'n');
$config->ai->openai->model = new stdclass();
$config->ai->openai->model->chat = 'gpt-3.5-turbo';
$config->ai->openai->model->function = 'gpt-3.5-turbo-0613';
$config->ai->openai->model->completion = 'text-davinci-003';
$config->ai->openai->model->edit = 'text-davinci-edit-001';
$config->ai->openai->contentTypeMapping = array('Content-Type: application/json' => array('', 'function', 'chat', 'completion', 'edit'), 'Content-Type: multipart/form-data' => array());
$config->ai->openai->contentType = array();
foreach($config->ai->openai->contentTypeMapping as $contentType => $apis)
{
foreach($apis as $api) $config->ai->openai->contentType[$api] = $contentType;
}
$config->ai->createprompt = new stdclass();
$config->ai->createprompt->requiredFields = 'name';
$config->ai->testPrompt = new stdclass();
$config->ai->testPrompt->requiredFields = 'name,module,source,purpose,targetForm';
$config->ai->dataSource = array();
$config->ai->dataSource['story']['story'] = array('title', 'spec', 'verify', 'product', 'module', 'pri', 'category', 'estimate');
$config->ai->dataSource['execution']['execution'] = array('name', 'desc', 'estimate');
$config->ai->dataSource['execution']['tasks'] = array('name', 'pri', 'status', 'estimate', 'consumed', 'left', 'progress', 'estStarted', 'realStarted', 'finishedDate', 'closedReason');
$config->ai->targetForm = array();
$config->ai->targetForm['story'] = array('create', 'batchcreate', 'change', 'totask', 'testcasecreate', 'subdivide');
$config->ai->targetForm['execution'] = array('batchcreatetask', 'createtestreport', 'createqa', 'createrisk', 'createissue');
/* Used to format form redirection links. */
$config->ai->targetFormVars = array();
$config->ai->targetFormVars['story'] = array('change' => 'storyID=%d');
$config->ai->targetFormVars['execution'] = array();
/* Menu printing configurations. */
$config->ai->menuPrint = new stdclass();
/**
* Menu location definations, defines acceptable module-methods and on page menu locations, etc.
*
* @param string $module prompt module name (actual module could differ from prompt module name)
* @param string $targetContainer injection target container selector
* @param string $class class of menu or dropdown button
* @param string $buttonClass specified class of action menu buttons
* @param string $dropdownClass specified class of dropdown menu button
* @param string $objectVarName object variable name of view
* @param string $stylesheet stylesheet to be injected
* @param string $injectMethod injection jQuery method, `append` by default
* @see ./view/promptmenu.html.php
*/
$config->ai->menuPrint->locations = array();
$config->ai->menuPrint->locations['story']['view'] = (object)array('module' => 'story', 'targetContainer' => '#mainContent .cell:first-of-type .detail:first-of-type .detail-title', 'class' => 'pull-right', 'stylesheet' => '#mainContent .cell:first-of-type .detail:first-of-type .detail-title>button {margin-left: 10px;} #mainContent .cell:first-of-type .detail:first-of-type .detail-content {margin-top: 12px;}');
$config->ai->menuPrint->locations['projectstory']['view'] = $config->ai->menuPrint->locations['story']['view'];
$config->ai->menuPrint->locations['execution']['storyView'] = $config->ai->menuPrint->locations['story']['view'];
$config->ai->menuPrint->locations['execution']['view'] = (object)array('module' => 'execution', 'injectMethod' => 'prepend', 'targetContainer' => '#mainContent.main-row > .col-4.side-col .detail:first-child', 'class' => 'pull-right');