feat:增加跨越配置

This commit is contained in:
2026-07-27 23:01:49 +08:00
parent 3ebb249516
commit 6831b250be
3 changed files with 42 additions and 37 deletions

View File

@@ -3,8 +3,9 @@
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" /> <excludeFolder url="file://$MODULE_DIR$/.venv" />
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content> </content>
<orderEntry type="jdk" jdkName="Python 3.10 (study-agent-service)" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.12 (study-agent-service)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

68
.idea/workspace.xml generated
View File

@@ -5,21 +5,9 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="c72023a9-a934-49fc-81d0-53a83489c638" name="Changes" comment=""> <list default="true" id="c72023a9-a934-49fc-81d0-53a83489c638" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/.env" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/study-agent-service.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/study-agent-service.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/profiles_settings.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/study-agent-service.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/agent/model.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/agent/prompt.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/agent/study.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/models/agent.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ocr.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/requirements.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/service.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/storage.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -38,29 +26,32 @@
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="ProjectColorInfo"><![CDATA[{ <component name="ProjectColorInfo">{
"associatedIndex": 4 &quot;associatedIndex&quot;: 4
}]]></component> }</component>
<component name="ProjectId" id="3H4xOetugdBhU5dfrCgc0HWwHSq" /> <component name="ProjectId" id="3H4xOetugdBhU5dfrCgc0HWwHSq" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent">{
"keyToString": { &quot;keyToString&quot;: {
"FastAPI.study-agent-service.executor": "Run", &quot;FastAPI.study-agent-service.executor&quot;: &quot;Run&quot;,
"RunOnceActivity.ShowReadmeOnStart": "true", &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
"git-widget-placeholder": "master", &quot;RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252&quot;: &quot;true&quot;,
"last_opened_file_path": "D:/Cxx/PythonProjects/study-agent-service", &quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
"node.js.detected.package.eslint": "true", &quot;RunOnceActivity.typescript.service.memoryLimit.init&quot;: &quot;true&quot;,
"node.js.detected.package.tslint": "true", &quot;git-widget-placeholder&quot;: &quot;master&quot;,
"node.js.selected.package.eslint": "(autodetect)", &quot;last_opened_file_path&quot;: &quot;D:/Projects/GithubProjects/study-agent-service&quot;,
"node.js.selected.package.tslint": "(autodetect)", &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
"nodejs_package_manager_path": "npm", &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
"vue.rearranger.settings.migration": "true" &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.lookFeel&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
} }
}]]></component> }</component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="D:\Cxx\PythonProjects\study-agent-service" /> <recent name="D:\Cxx\PythonProjects\study-agent-service" />
@@ -75,12 +66,14 @@
<option name="ENV_FILES" value="" /> <option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" /> <option name="SDK_HOME" value="$PROJECT_DIR$/venv/Scripts/python.exe" />
<option name="SDK_NAME" value="Python 3.12 (study-agent-service)" />
<option name="WORKING_DIRECTORY" value="" /> <option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" /> <option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="RUN_TOOL" value="" />
<option name="launchJavascriptDebuger" value="false" /> <option name="launchJavascriptDebuger" value="false" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
@@ -88,8 +81,8 @@
<component name="SharedIndexes"> <component name="SharedIndexes">
<attachedChunks> <attachedChunks>
<set> <set>
<option value="bundled-js-predefined-d6986cc7102b-1632447f56bf-JavaScript-PY-243.26053.29" /> <option value="bundled-js-predefined-d6986cc7102b-9b0f141eb926-JavaScript-PY-253.29346.142" />
<option value="bundled-python-sdk-b1dbf8ef85a6-4df51de95216-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-243.26053.29" /> <option value="bundled-python-sdk-f2b7a9f6281b-6e1f45a539f7-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-253.29346.142" />
</set> </set>
</attachedChunks> </attachedChunks>
</component> </component>
@@ -102,6 +95,9 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1785141112222</updated> <updated>1785141112222</updated>
<workItem from="1785141113303" duration="9082000" /> <workItem from="1785141113303" duration="9082000" />
<workItem from="1785159872080" duration="227000" />
<workItem from="1785160109659" duration="37000" />
<workItem from="1785160154886" duration="2395000" />
</task> </task>
<servers /> <servers />
</component> </component>
@@ -109,6 +105,6 @@
<option name="version" value="3" /> <option name="version" value="3" />
</component> </component>
<component name="com.intellij.coverage.CoverageDataManagerImpl"> <component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/study_agent_service$study_agent_service.coverage" NAME="study-agent-service Coverage Results" MODIFIED="1785153562933" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" /> <SUITE FILE_PATH="coverage/study_agent_service$study_agent_service.coverage" NAME="study-agent-service Coverage Results" MODIFIED="1785160762107" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
</component> </component>
</project> </project>

View File

@@ -1,4 +1,5 @@
from fastapi import FastAPI, UploadFile, File from fastapi import FastAPI, UploadFile, File
from starlette.middleware.cors import CORSMiddleware
from starlette.responses import StreamingResponse from starlette.responses import StreamingResponse
from models.agent import QueryRequest from models.agent import QueryRequest
@@ -8,6 +9,13 @@ from ocr import ocr_from_url
app = FastAPI(title="AI Study Service") app = FastAPI(title="AI Study Service")
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_methods=["*"],
allow_headers=["*"],
)
@app.post("/upload") @app.post("/upload")
def upload(file: UploadFile = File(...)): def upload(file: UploadFile = File(...)):