提交 3a102b2f 编写于 作者: D DebugIsFalse

fix: 删除分号

上级 1fcb6dd7
......@@ -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
})
}
}
......
......@@ -19,17 +19,17 @@ const initMarkdownIt = new MarkdownIt({
try {
return `<pre><code class="language-${lang} hljs">` +
hljs.highlight(str, { language: lang, ignoreIllegals: true }).value +
'</code></pre>';
'</code></pre>'
} catch (__) {}
}
return '<pre><code class="language-none hljs">' + initMarkdownIt.utils.escapeHtml(str) + '</code></pre>';
return '<pre><code class="language-none hljs">' + initMarkdownIt.utils.escapeHtml(str) + '</code></pre>'
}
})
const handleRenderMd = () => {
mdHtml.value = initMarkdownIt.render(props.content || '');
mdHtml.value = initMarkdownIt.render(props.content || '')
}
watch( () => props.content, () => {
handleRenderMd();
handleRenderMd()
}, { immediate: true })
</script>
\ No newline at end of file
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
......@@ -33,6 +33,6 @@
<script setup>
const isOpenAside = ref(false)
const handleToogleAside = () => {
isOpenAside.value = !isOpenAside.value;
isOpenAside.value = !isOpenAside.value
}
</script>
......@@ -7,8 +7,8 @@
</template>
<script setup>
const mdContent = ref('');
const { loading, fetchRequest } = useFetchRequest();
const mdContent = ref('')
const { loading, fetchRequest } = useFetchRequest()
// const { data } = await useFetch('/api/fetchMarkdown')
// mdContent.value = data.value.content
async function fetchMarkdownContent () {
......@@ -19,9 +19,9 @@ function fetchSseContent() {
fetchRequest('/api/mock/test').then((response) => {
console.log(response)
})
// const myHeaders = new Headers();
// myHeaders.append("Authorization", "Bearer fk188579-fptzRyRKlkoTE6T2bDjteXYor6ulTGeb");
// myHeaders.append("Content-Type", "application/json");
// const myHeaders = new Headers()
// myHeaders.append("Authorization", "Bearer fk188579-fptzRyRKlkoTE6T2bDjteXYor6ulTGeb")
// myHeaders.append("Content-Type", "application/json")
// const raw = JSON.stringify({
// model: "gpt-3.5-turbo",
// messages: [
......@@ -32,18 +32,18 @@ function fetchSseContent() {
// ],
// safe_mode: false,
// stream: true
// });
// })
// var requestOptions = {
// method: 'POST',
// headers: myHeaders,
// body: raw,
// redirect: 'follow'
// };
// }
// window.fetch("https://oa.api2d.net/v1/chat/completions", requestOptions)
// .then(response => response.text())
// .then(result => {
// console.log(result)
// })
// .catch(error => console.log('error', error));
// .catch(error => console.log('error', error))
}
</script>
\ No newline at end of file
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',
......
......@@ -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)
......@@ -11,5 +11,5 @@ export default (url, { onmessage, onerror, controller, params }) => {
onmessage,
onerror,
signal: controller && controller.signal
});
})
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册