Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug-cli successfully receives references but prod does not work #14

Open
shyim opened this issue Nov 23, 2024 · 1 comment
Open

debug-cli successfully receives references but prod does not work #14

shyim opened this issue Nov 23, 2024 · 1 comment

Comments

@shyim
Copy link

shyim commented Nov 23, 2024

Hey,

in cli I get

Image

but the web always errors without anything

Image

I am also totally lost as the docs are not very clear how to attach to a message references.

My code is:

w.writeEvent("copilot_references")
w.writeData(copilotReferences)
w.writeDone()

w.writeData(sseResponse{
	Choices: choices,
})

w.writeDone()

My SSE looks like this:

event: copilot_references
data: [{"type":"document","id":"data/docs/guides/hosting/performance/caches.md_0","metadata":{"display_name":"guides/hosting/performance/caches.md","display_icon":"icon","display_url":"https://github.com/shopware/docs/blob/main/guides/hosting/performance/caches.md"}},{"type":"document","id":"data/docs/guides/hosting/performance/performance-tweaks.md_0","metadata":{"display_name":"guides/hosting/performance/performance-tweaks.md","display_icon":"icon","display_url":"https://github.com/shopware/docs/blob/main/guides/hosting/performance/performance-tweaks.md"}},{"type":"document","id":"data/src/Administration/Resources/app/administration/src/module/sw-settings-cache/component/sw-settings-cache-modal/sw-settings-cache-modal.twig_0","metadata":{"display_name":"src/Administration/Resources/app/administration/src/module/sw-settings-cache/component/sw-settings-cache-modal/sw-settings-cache-modal.twig","display_icon":"icon","display_url":"https://github.com/shopware/shopware/blob/trunk/src/Administration/Resources/app/administration/src/module/sw-settings-cache/component/sw-settings-cache-modal/sw-settings-cache-modal.twig"}},{"type":"document","id":"data/docs/guides/hosting/performance/index.md_0","metadata":{"display_name":"guides/hosting/performance/index.md","display_icon":"icon","display_url":"https://github.com/shopware/docs/blob/main/guides/hosting/performance/index.md"}},{"type":"document","id":"data/docs/products/extensions/migration-assistant/guides.md_0","metadata":{"display_name":"products/extensions/migration-assistant/guides.md","display_icon":"icon","display_url":"https://github.com/shopware/docs/blob/main/products/extensions/migration-assistant/guides.md"}}]
data: [DONE]

data: {"choices":[{"index":0,"delta":{"role":"assistant","content":"Clearing the cache in Shopware 6 can be done using the command line, Admin interface, or via code execution. Below are the steps for each method:\n\n### Via Command Line\n\n1. **Open your terminal or SSH into your server**.\n2. **Navigate to your Shopware installation directory**.\n3. **Run the cache clear command**:\n\n```sh\nbin/console cache:clear\n```\n\nThis will clear all caches in the Shopware system.\n\n### Via Admin Interface\n\n1. **Log in to Shopware Admin**.\n2. **Go to the \"Settings\" section**.\n3. **Navigate to \"System\" \u003e \"Caches \u0026 Indexes\"**.\n4. **Click the \"Clear Cache\" button**.\n\nA modal will appear to confirm the action, and you can proceed by clicking the appropriate button to clear the cache.\n\n### Programmatically via Code\n\nIf you want to clear the cache programmatically, you can use the `cache.warmer` service.\n\nHere's an example:\n\n```php\n\u003c?php\nnamespace App\\Controller;\n\nuse Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Contracts\\Service\\Attribute\\Required;\n\nclass CacheController extends AbstractController\n{\n    private $cacheWarmer;\n\n    /**\n     * @Required\n     */\n    public function setCacheWarmer($cacheWarmer)\n    {\n        $this-\u003ecacheWarmer = $cacheWarmer;\n    }\n\n    public function clearCache(): Response\n    {\n        $this-\u003ecacheWarmer-\u003eclear();\n\n        return new Response('Cache cleared');\n    }\n}\n```\n\n### Specific Cache Types\n\nYou might want to clear specific types of cache (e.g. HTTP cache, template cache, etc.). Here’s how to clear them:\n\n#### HTTP Cache\n\n```sh\nbin/console http:cache:clear\n```\n\n#### Template Cache\n\n```sh\nbin/console theme:compile\n```\n\n### Summary\n\n- Use `bin/console cache:clear` to clear the entire cache via terminal.\n- Use the Admin interface in the \"Settings\" section to clear the cache.\n- Clear cache programmatically by leveraging the `cache.warmer` service.\n- Use specific commands for clearing specific caches like HTTP or template cache.\n\nEach method caters to different needs, and you can choose the one that best fits your scenario. If you face any issues clearing the cache, ensure that the file permissions are correctly set for the cache directories."}}]}
data: [DONE]
@StanislavUhimenko
Copy link

Вірно

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants