diff --git a/components/i/Create.vue b/components/i/Create.vue index 2449fb5ac8458b300c25bdc48dfd18206ac92f8b..a49d45cc16bb03d749142ddf9780745f5ee3cb51 100644 --- a/components/i/Create.vue +++ b/components/i/Create.vue @@ -38,21 +38,21 @@ const repos = ref([ { url: 'https://github.com/allwefantasy/byzer-llm.git', label: 'byzer-llm', branch: 'master' }, { url: 'https://github.com/keycloak/keycloak.git', label: 'keycloak', branch: 'master' } ]) -const loading = ref(false); +const loading = ref(false) const handleSearch = async () => { - if (loading.value) return; - loading.value = true; + if (loading.value) return + loading.value = true const result = await fetchRequest('/v1/chat/completion/create', { method: 'post', headers: { 'Content-Type': 'application/x-www-form-urlencoded' } - }); + }) if (result && result.data) { - const currentRepo = repos.value.find(item => item.label === selectedRepo.value); - navigateTo(`/search/${result.data.c_id}?query=${query.value}&repo=${selectedRepo.value}`); + const currentRepo = repos.value.find(item => item.label === selectedRepo.value) + navigateTo(`/search/${result.data.c_id}?query=${query.value}&repo=${selectedRepo.value}`) nextTick(() => { - loading.value = false; + loading.value = false }) } } diff --git a/components/md/renderer.vue b/components/md/renderer.vue index b07a27268be636811867448a6cb1edd2ff46ad80..f1bbd5eba3ee7147ec176dd46652f33e35f04d13 100644 --- a/components/md/renderer.vue +++ b/components/md/renderer.vue @@ -19,17 +19,17 @@ const initMarkdownIt = new MarkdownIt({ try { return `
` +
                hljs.highlight(str, { language: lang, ignoreIllegals: true }).value +
-               '
'; + '' } catch (__) {} } - return '
' + initMarkdownIt.utils.escapeHtml(str) + '
'; + return '
' + initMarkdownIt.utils.escapeHtml(str) + '
' } }) const handleRenderMd = () => { - mdHtml.value = initMarkdownIt.render(props.content || ''); + mdHtml.value = initMarkdownIt.render(props.content || '') } watch( () => props.content, () => { - handleRenderMd(); + handleRenderMd() }, { immediate: true }) \ No newline at end of file diff --git a/composables/useFetchRequest.js b/composables/useFetchRequest.js index 46d1fd9cc0a7b6bfba1975d1e865afea9a2e97c0..91c9e6d56ad427397bf787ae258901b5031067e9 100644 --- a/composables/useFetchRequest.js +++ b/composables/useFetchRequest.js @@ -1,18 +1,18 @@ const BASE_URL = 'https://gpu-pod656e861afe3d944d6b3ce77e-7862.node.inscode.run' const useFetchRequest = (baseUrl) => { - baseUrl = baseUrl || BASE_URL; + baseUrl = baseUrl || BASE_URL const config = { headers: {} - }; + } const fetchRequest = (url, fetchConfig) => { - url = `${BASE_URL}${url}`; - fetchConfig = fetchConfig || {}; - fetchConfig.method = (fetchConfig.method || 'get').toLocaleUpperCase(); - fetchConfig = Object.assign(config, fetchConfig); - return $fetch(url, fetchConfig); + url = `${BASE_URL}${url}` + fetchConfig = fetchConfig || {} + fetchConfig.method = (fetchConfig.method || 'get').toLocaleUpperCase() + fetchConfig = Object.assign(config, fetchConfig) + return $fetch(url, fetchConfig) } return { fetchRequest } } -export default useFetchRequest; \ No newline at end of file +export default useFetchRequest \ No newline at end of file diff --git a/layouts/default.vue b/layouts/default.vue index d407df5ce71f4b396e522582e493717bbaf09f77..4043e5e6527bcab2afb09644ed931d8ba6775005 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -33,6 +33,6 @@ diff --git a/pages/md.vue b/pages/md.vue index f653d74379946669ce4a645f8927138b6aef5486..33f94b8a74c7bbea323a32fb0fe0ff7fa01808fa 100644 --- a/pages/md.vue +++ b/pages/md.vue @@ -7,8 +7,8 @@ \ No newline at end of file diff --git a/server/api/fetchMarkdown.js b/server/api/fetchMarkdown.js index 74bd431599ffbe3da3b4b7168f19aba0a9928f60..7e09b818dcc09e63917fd83faffb6187bc93c151 100644 --- a/server/api/fetchMarkdown.js +++ b/server/api/fetchMarkdown.js @@ -1,6 +1,6 @@ export default defineEventHandler(async (event) => { // const config = useRuntimeConfig(event) - const cookie = event.headers.get('cookie'); + const cookie = event.headers.get('cookie') // console.log(`config:`, event.headers.get('cookie')) const repo = await $fetch('https://ieditor-ai.inscode.cc/ai/md', { method: 'POST', diff --git a/server/api/mock/[...slug].js b/server/api/mock/[...slug].js index ca5447bc617b5fcd030cb0a83d93e0b1ee78315d..25ed0f72799a9485150cf5df0382cf9628c57540 100644 --- a/server/api/mock/[...slug].js +++ b/server/api/mock/[...slug].js @@ -3,7 +3,7 @@ import { createRouter, defineEventHandler, useBase } from 'h3' const router = createRouter() router.get('/test', defineEventHandler(() => { - return 'data:{"message":"success","data":{"id":"c_20240516095719_bfaJkBJyg4KTwL8g","object":"chat.completion","created":1715824958,"model":"chat_qwen110b","choices":[{"index":0,"message":{"role":"assistant","content":"Hello! I\'m here to help you with any questions or tasks related to the Byzer-LLM project or its usage. Whether you need assistance with deployment, querying models, understanding the integration process, or exploring its features, feel free to ask. For instance, if you\'re looking to set up a model like `sparkdesk_chat`, run a simple inference, validate the model, or even understand how to use Python scripts for interacting with Byzer-LLM, just let me know your specific inquiry!"},"finish_reason":"stop"}],"usage":{"prompt_tokens":6653,"completion_tokens":104,"total_tokens":6757},"meta":{"type":"answer"}}}'; + return 'data:{"message":"success","data":{"id":"c_20240516095719_bfaJkBJyg4KTwL8g","object":"chat.completion","created":1715824958,"model":"chat_qwen110b","choices":[{"index":0,"message":{"role":"assistant","content":"Hello! I\'m here to help you with any questions or tasks related to the Byzer-LLM project or its usage. Whether you need assistance with deployment, querying models, understanding the integration process, or exploring its features, feel free to ask. For instance, if you\'re looking to set up a model like `sparkdesk_chat`, run a simple inference, validate the model, or even understand how to use Python scripts for interacting with Byzer-LLM, just let me know your specific inquiry!"},"finish_reason":"stop"}],"usage":{"prompt_tokens":6653,"completion_tokens":104,"total_tokens":6757},"meta":{"type":"answer"}}}' })) export default useBase('/api/mock', router.handler) diff --git a/utils/fetchEventSource.js b/utils/fetchEventSource.js index 254be649e9f6328e66e3c2d9ad420dc66d196cd9..3020f4d58f00fb67bed8d3ac6a5119de225d7450 100644 --- a/utils/fetchEventSource.js +++ b/utils/fetchEventSource.js @@ -11,5 +11,5 @@ export default (url, { onmessage, onerror, controller, params }) => { onmessage, onerror, signal: controller && controller.signal - }); + }) } \ No newline at end of file