Вопрос:
Я разрабатываю приложение с использованием FastAPI и сталкиваюсь с ошибкой 404 Not Found при попытке отправить его. ответ на конечную точку /submit_response. Ниже приведены соответствующие части моего кода: main.py:
INFO:main:Request: POST http://localhost:8000/submit_response
INFO:__main__:Response status: 404
INFO: 127.0.0.1:52983 - "POST /submit_response HTTP/1.1" 404 Not Found
Я подтвердил, что сервер FastAPI работает и конечная точка / работает нормально. Что может быть причиной ошибки 404 Not Found для конечной точки /submit_response?
[b]Вопрос:[/b] Я разрабатываю приложение с использованием FastAPI и сталкиваюсь с ошибкой 404 Not Found при попытке отправить его. ответ на конечную точку /submit_response. Ниже приведены соответствующие части моего кода: [b]main.py:[/b] [code]from fastapi import FastAPI, HTTPException, Request, File, UploadFile, Form from fastapi.templating import Jinja2Templates from pydantic import BaseModel from typing import Optional import uuid from fastapi.middleware.cors import CORSMiddleware
# Import necessary functions from your utils file from utils import *
# Read the audio file audio_content = await audio.read()
# Transcribe the audio response = transcribe_audio(audio_content)
# Update the current scenario conversation with the candidate's response session.current_scenario_conversation[-1] = ( session.current_scenario_conversation[-1][0], session.current_scenario_conversation[-1][1], response ) save_conversation_to_file(session.interview_filename, session.current_scenario_conversation[-1])
# Retrieve the current trait and perform satisfaction check trait = TRAITS[session.current_trait_index] status, feedback = satisfaction_check( session.agents["satisfaction_check"], session.current_scenario_conversation[-1][1], response, trait['trait_name'] )
if status == "satisfied": # If satisfied, score the scenario and move to the next trait/scenario score = score_scenario(session.agents["scoring"], session.current_scenario_conversation, trait) save_conversation_to_file(session.interview_filename, ("Score", score)) next_scenario = move_to_next_scenario(session) return { "message": "Moving to next scenario", "question": next_scenario["question"] if "question" in next_scenario else None, "score": score } elif status == "insufficient": # If the response is insufficient, generate a follow-up question if len(session.current_scenario_conversation) >= 2: next_scenario = move_to_next_scenario(session) return { "message": "Moving to next scenario due to insufficient response", "question": next_scenario["question"] if "question" in next_scenario else None } else: follow_up_question = generate_follow_up( session.agents["follow_up"], session.candidate_name, session.current_scenario_conversation, len(session.current_scenario_conversation), insufficient=True ) session.current_scenario_conversation.append(("Follow-Up", len(session.current_scenario_conversation), follow_up_question, "")) save_conversation_to_file(session.interview_filename, session.current_scenario_conversation[-1]) return { "message": "Follow-up question for insufficient response", "question": follow_up_question } else: # unsatisfied # Generate a follow-up question for unsatisfactory response follow_up_question = generate_follow_up( session.agents["follow_up"], session.candidate_name, session.current_scenario_conversation, len(session.current_scenario_conversation), insufficient=False ) session.current_scenario_conversation.append(("Follow-Up", len(session.current_scenario_conversation), follow_up_question, "")) save_conversation_to_file(session.interview_filename, session.current_scenario_conversation[-1])
if len(session.current_scenario_conversation) >= 3: next_scenario = move_to_next_scenario(session) return { "message": "Moving to next scenario after follow-up", "question": next_scenario["question"] if "question" in next_scenario else None }
if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); }
const data = await response.json(); logConversation('Candidate', 'Audio Response');
if (data.message === 'Interview completed') { alert('Interview completed. Thank you for your participation!'); resetInterview(); } else { displayQuestion(data.question); if (data.score) { setScenarioScore(data.score); logConversation('System', `Scenario score: ${data.score}`); } if (data.message) { logConversation('System', data.message); } } } catch (error) { console.error('Error:', error); alert('An error occurred while submitting your response. Please try again.'); } }; [/code] Когда я пытаюсь отправить POST-запрос на http://localhost:8000/submit_response, в журналах появляется следующая ошибка: [code]INFO:main:Request: POST http://localhost:8000/submit_response INFO:__main__:Response status: 404 INFO: 127.0.0.1:52983 - "POST /submit_response HTTP/1.1" 404 Not Found [/code] Я подтвердил, что сервер FastAPI работает и конечная точка / работает нормально. Что может быть причиной ошибки 404 Not Found для конечной точки /submit_response?
Я разрабатываю веб-приложение, развернутое в Azure. Конечная точка регистрации моего API возвращает ошибку 404 Not Found при доступе из внешнего интерфейса. Бэкэнд настроен для обработки запросов на регистрацию, а внешний интерфейс правильно...
Простая проблема. Я запускаю VS2008 и создаю новое приложение службы WCF. Это создаст приложение по умолчанию с несколькими методами тестирования, показывающими его работу. Я нажимаю CTRL+F5 и это действительно работает! Большой! Однако он...
Сегодня я создал множество функций с помощью Entity Framework и postgres и протестировал их все на локальном хосте. Итак, я выполнил развертывание в Azure, и когда я протестировал его на портале Azure, все вернуло ошибку 404. Я пробовал много вещей,...
У меня есть контроллер, использующий аннотацию RequestMapping, но всякий раз, когда я посещаю страницу /books, я получаю ошибку белой метки.
package come.saeedado.controllers;
У меня есть контроллер, использующий аннотацию RequestMapping, но всякий раз, когда я посещаю страницу /books, я получаю ошибку белой метки.
package come.saeedado.controllers;