Skip to content

Commit

Permalink
Merge pull request #4: Add Prompt finder
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk authored Sep 6, 2024
2 parents 81b12f3 + 3c070b9 commit 093865d
Show file tree
Hide file tree
Showing 32 changed files with 631 additions and 173 deletions.
2 changes: 1 addition & 1 deletion ai.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!-- Example -->
<ai
temp-dir="./runtime"
cache-dir="./runtime/.ai"
>
<source>
<include>
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"psr/container": "^2.0",
"psr/log": "^3.0.1",
"psr/simple-cache": "^3.0",
"symfony/finder": "^7.1"
"symfony/finder": "^7.1",
"yiisoft/cache-file": "^3.1",
"yiisoft/injector": "^1.2"
},
"require-dev": {
"buggregator/trap": "^1.10",
Expand Down
222 changes: 151 additions & 71 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 22 additions & 7 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.25.0@01a8eb06b9e9cc6cfb6a320bf9fb14331919d505">
<file src="src/Service/Container/ContainerImpl.php">
<file src="src/Module/Finder/Internal/PromptFinderImpl.php">
<MixedInferredReturnType>
<code><![CDATA[PromptCache]]></code>
</MixedInferredReturnType>
<MixedReturnStatement>
<code><![CDATA[$this->cache->get(self::CACHE_KEY) ?? new PromptCache()]]></code>
<code><![CDATA[$this->cache->get(self::CACHE_KEY) ?? new PromptCache()]]></code>
</MixedReturnStatement>
</file>
<file src="src/Service/Factoriable.php">
<InvalidDocblock>
<code><![CDATA[Factoriable]]></code>
</InvalidDocblock>
</file>
<file src="src/Service/Internal/Cache/PsrCache.php">
<MixedAssignment>
<code><![CDATA[$value]]></code>
<code><![CDATA[$value]]></code>
</MixedAssignment>
</file>
<file src="src/Service/Internal/Container/ContainerImpl.php">
<InvalidReturnType>
<code><![CDATA[object]]></code>
</InvalidReturnType>
</file>
<file src="src/Service/Container/Injection/ConfigLoader.php">
<file src="src/Service/Internal/Container/Injection/ConfigLoader.php">
<MixedMethodCall>
<code><![CDATA[new $attribute->class()]]></code>
</MixedMethodCall>
<RedundantCondition>
<code><![CDATA[\assert($xml instanceof \SimpleXMLElement)]]></code>
</RedundantCondition>
</file>
<file src="src/Service/Factoriable.php">
<InvalidDocblock>
<code><![CDATA[Factoriable]]></code>
</InvalidDocblock>
</file>
</files>
18 changes: 12 additions & 6 deletions src/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@

namespace LLM\Assistant;

use LLM\Assistant\Module\Finder\Finder;
use LLM\Assistant\Module\Finder\Internal\FinderImpl;
use LLM\Assistant\Module\Finder\FilesystemFinder;
use LLM\Assistant\Module\Finder\Internal\FilesystemFinderImpl;
use LLM\Assistant\Module\Finder\Internal\PromptFinderImpl;
use LLM\Assistant\Module\Finder\PromptFinder;
use LLM\Assistant\Service\Cache;
use LLM\Assistant\Service\Container;
use LLM\Assistant\Service\Container\ContainerImpl;
use LLM\Assistant\Service\Container\Injection\ConfigLoader;
use LLM\Assistant\Service\Internal\Cache\PsrCache;
use LLM\Assistant\Service\Internal\Container\ContainerImpl;
use LLM\Assistant\Service\Internal\Container\Injection\ConfigLoader;
use LLM\Assistant\Service\Internal\Logger\LoggerImpl;
use LLM\Assistant\Service\Logger;
use LLM\Assistant\Service\Logger\LoggerImpl;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\StyleInterface;
Expand Down Expand Up @@ -44,7 +48,9 @@ public function finish(): Container
$c = $this->container;
unset($this->container);

$c->bind(Finder::class, FinderImpl::class);
$c->bind(FilesystemFinder::class, FilesystemFinderImpl::class);
$c->bind(PromptFinder::class, PromptFinderImpl::class);
$c->bind(Cache::class, PsrCache::class);

return $c;
}
Expand Down
13 changes: 8 additions & 5 deletions src/Command/Run.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace LLM\Assistant\Command;

use LLM\Assistant\Module\Finder\Finder;
use LLM\Assistant\Module\Finder\PromptFinder;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -32,11 +32,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$this->logger->alert('Assistant is running');

$finder = $this->container->get(Finder::class);
$finder = $this->container->get(PromptFinder::class);

foreach ($finder->files() as $name => $file) {
$this->logger->info($name);
}
#AI test
tr($finder->getNext());

// foreach ($finder->files() as $name => $file) {
// $this->logger->info($name);
// }

return Command::SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace LLM\Assistant\Service\Container\Attribute;
namespace LLM\Assistant\Config\Attribute;

/**
* @internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace LLM\Assistant\Service\Container\Attribute;
namespace LLM\Assistant\Config\Attribute;

/**
* @internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace LLM\Assistant\Service\Container\Attribute;
namespace LLM\Assistant\Config\Attribute;

/**
* @internal
Expand Down
Loading

0 comments on commit 093865d

Please sign in to comment.