-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: (32 commits) rebuild the index when the embedding model changed fix info output on used models auto style fixes ask the rephrased question only if it has more context print score in chat set custom info text for simulate sub command emit the INDEXER_PAGE_ADD event make threshold configurable mechanisms to override things on command line animate button on first show automatic stylefixes better JSON exception handling in storages small adjustments prefer prompted user messages over system prompts various refactoring and introduction of a simulate command separate the rephrasing model from the chat model do not hardcode dimensions in qdrant storage fix syntax error in qdrant storage fix info output correctly use storage setting ...
- Loading branch information
Showing
44 changed files
with
1,852 additions
and
533 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace dokuwiki\plugin\aichat; | ||
|
||
use dokuwiki\Extension\CLIPlugin; | ||
use splitbrain\phpcli\Options; | ||
|
||
abstract class AbstractCLI extends CLIPlugin | ||
{ | ||
/** @var \helper_plugin_aichat */ | ||
protected $helper; | ||
|
||
/** @inheritdoc */ | ||
public function __construct($autocatch = true) | ||
{ | ||
parent::__construct($autocatch); | ||
$this->helper = plugin_load('helper', 'aichat'); | ||
$this->helper->setLogger($this); | ||
$this->loadConfig(); | ||
ini_set('memory_limit', -1); | ||
} | ||
|
||
/** @inheritdoc */ | ||
protected function setup(Options $options) | ||
{ | ||
$options->useCompactHelp(); | ||
|
||
$options->registerOption( | ||
'lang', | ||
'When set to a language code, it overrides the the lang and preferUIlanguage settings and asks the ' . | ||
'bot to always use this language instead. ' . | ||
'When set to "auto" the bot is asked to detect the language of the input falling back to the wiki lang.', | ||
'', | ||
'lang' | ||
); | ||
} | ||
|
||
/** @inheritDoc */ | ||
protected function main(Options $options) | ||
{ | ||
if ($this->loglevel['debug']['enabled']) { | ||
$this->helper->factory->setDebug(true); | ||
} | ||
|
||
$lc = $options->getOpt('lang'); | ||
if ($lc === 'auto') { | ||
$this->helper->updateConfig(['preferUIlanguage' => 0]); | ||
} elseif ($lc) { | ||
$this->helper->updateConfig(['preferUIlanguage' => 1]); | ||
global $conf; | ||
$conf['lang'] = $lc; | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.