mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-28 01:53:53 +08:00
修复WebUI api 请求地址,更新docker 部署
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
import Login from './components/Login.vue';
|
||||
import Registration from './components/Registration.vue';
|
||||
import panel from './components/panel.vue';
|
||||
import MainPage from './components/main.vue';
|
||||
import MainPage from './components/Main.vue';
|
||||
import RoleSetting from './components/RoleSetting.vue';
|
||||
import Footer from './components/Footer.vue';
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { API_BASE_URL } from '../config/api';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -34,7 +36,7 @@
|
||||
|
||||
this.isLoading = true;
|
||||
try {
|
||||
const response = await fetch(`${import.meta.env.VITE_API_BASE_URL}/api/login`, {
|
||||
const response = await fetch(`${API_BASE_URL}/api/login`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { API_BASE_URL } from '../config/api';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -47,7 +49,7 @@ export default {
|
||||
|
||||
this.isLoading = true;
|
||||
try {
|
||||
const response = await fetch(`${import.meta.env.VITE_API_BASE_URL}/api/register`, {
|
||||
const response = await fetch(`${API_BASE_URL}/api/register`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
</option>
|
||||
</select>
|
||||
<div class="model-description">
|
||||
除了“qwen-turbo”,其他模型通常会增加约 1 秒的延迟。改变模型后,建议清空记忆体,以免影响体验。
|
||||
除了"qwen-turbo",其他模型通常会增加约 1 秒的延迟。改变模型后,建议清空记忆体,以免影响体验。
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -109,6 +109,7 @@
|
||||
import { ref, onMounted } from 'vue';
|
||||
import NavBar from './NavBar.vue';
|
||||
import RoleTemplates from '../utils/RoleTemplates';
|
||||
import { API_BASE_URL } from '../config/api';
|
||||
|
||||
const roleTemplates = RoleTemplates.getTemplates();
|
||||
|
||||
@@ -120,7 +121,7 @@ const activeMemoryTab = ref('recent');
|
||||
const memoryContent = ref('');
|
||||
const selectedModel = ref('qianwen');
|
||||
|
||||
const baseUrl = import.meta.env.VITE_API_BASE_URL;
|
||||
const baseUrl = API_BASE_URL;
|
||||
const moduleOptions = ref({
|
||||
LLM: [],
|
||||
TTS: [],
|
||||
|
||||
@@ -41,10 +41,11 @@
|
||||
import { ref, onMounted } from 'vue';
|
||||
import NavBar from './NavBar.vue';
|
||||
import DeviceCard from './DeviceCard.vue';
|
||||
import { API_BASE_URL } from '../config/api';
|
||||
|
||||
const emit = defineEmits(['show-role', 'go-home']);
|
||||
|
||||
const baseUrl = import.meta.env.VITE_API_BASE_URL;
|
||||
const baseUrl = API_BASE_URL;
|
||||
const devices = ref([]);
|
||||
|
||||
const formatLastActivity = (timestamp) => {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// 获取当前运行环境的基础 URL
|
||||
const getBaseUrl = () => {
|
||||
// 如果是开发环境,使用环境变量中的地址
|
||||
if (import.meta.env.DEV) {
|
||||
return import.meta.env.VITE_API_BASE_URL;
|
||||
}
|
||||
|
||||
// 生产环境使用当前域名和端口
|
||||
const protocol = window.location.protocol;
|
||||
const hostname = window.location.hostname;
|
||||
const port = window.location.port;
|
||||
|
||||
return `${protocol}//${hostname}${port ? `:${port}` : ''}`;
|
||||
};
|
||||
|
||||
export const API_BASE_URL = getBaseUrl();
|
||||
Reference in New Issue
Block a user