-
Notifications
You must be signed in to change notification settings - Fork 4
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
Feat: add llm debug page #3
Merged
Merged
Conversation
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
"Added functionality to fetch and display article content and is_advertorial field from the backend /craft-debug/advertorial API in the LLM Debug Page." # Aider chat conversation: USER: in llm-debug page, when user input a article url and click submit button , then make request to backend /craft-debug/advertorial api and get response, then extract the article content field and is_advertorial field, then show them in the page ASSISTANT: To implement the feature you described, we need to modify the `llm-debug.vue` file. Here are the changes: web/admin/src/views/dashboard/llm-debug/llm-debug.vue ```vue <<<<<<< SEARCH <template> <div class="py-8 px-16"> <h1 class="text-3xl font-bold">LLM Debug Page</h1> <!-- Add your content here --> </div> </template> <script lang="ts" setup> // Add your script here </script> <script lang="ts"> export default { name: 'LLMDebug', }; </script> ======= <template> <div class="py-8 px-16"> <h1 class="text-3xl font-bold">LLM Debug Page</h1> <a-card class="my-2" title="输入链接"> <p>输入要预览的RSS源地址 支持RSS/ATOM</p> <a-space> <a-input v-model="articleUrl" type="text" placeholder="Enter article URL" /> <a-button @click="fetchArticle">Submit</a-button> </a-space> </a-card> <a-card title="结果预览" class="my-4"> <div v-if="articleContent"> <p>Article Content: {{ articleContent }}</p> <p>Is Advertorial: {{ isAdvertorial }}</p> </div> <a-empty v-else /> </a-card> </div> </template> <script lang="ts" setup> import { ref } from 'vue'; import { Message } from '@arco-design/web-vue'; const articleUrl = ref(''); const articleContent = ref(''); const isAdvertorial = ref(false); async function fetchArticle() { const requestUrl = `${baseUrl}/craft-debug/advertorial`; try { const resp = await fetch(requestUrl, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ url: articleUrl.value }), }); const data = await resp.json(); articleContent.value = data.article_content; isAdvertorial.value = data.is_advertorial; } catch (error) { Message.warning(error?.toString() ?? 'Unknown Error'); console.error(error); } } </script> <script lang="ts"> export default { name: 'LLMDebug', }; </script> >>>>>>> REPLACE ```
… for simplified HTTP POST requests." # Aider chat conversation: USER: use axios to make it more simple ASSISTANT: Sure, I can help you simplify the fetchArticle function in the `llm-debug.vue` file using axios. Here's the *SEARCH/REPLACE* block for the changes: web/admin/src/views/dashboard/llm-debug/llm-debug.vue ```vue <<<<<<< SEARCH async function fetchArticle() { const requestUrl = `${baseUrl}/craft-debug/advertorial`; try { const resp = await fetch(requestUrl, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ url: articleUrl.value }), }); const data = await resp.json(); articleContent.value = data.article_content; isAdvertorial.value = data.is_advertorial; } catch (error) { Message.warning(error?.toString() ?? 'Unknown Error'); console.error(error); } } ======= import axios from 'axios'; async function fetchArticle() { try { const resp = await axios.post(`${baseUrl}/craft-debug/advertorial`, { url: articleUrl.value, }); articleContent.value = resp.data.article_content; isAdvertorial.value = resp.data.is_advertorial; } catch (error) { Message.warning(error?.toString() ?? 'Unknown Error'); console.error(error); } } >>>>>>> REPLACE ``` This change simplifies the fetchArticle function by using axios to make the POST request. It also imports axios at the top of the script.
# Conflicts: # web/admin/src/views/dashboard/llm-debug/llm-debug.vue
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.