TonyMoralist commited on
Commit
f35cb76
·
verified ·
1 Parent(s): 5c1ff2b

Upload 6 files

Browse files
Files changed (6) hide show
  1. .env.example +14 -0
  2. Dockerfile +12 -0
  3. chatbot.db +0 -0
  4. logs.txt +0 -0
  5. logs_err.txt +187 -0
  6. requirements.txt +24 -0
.env.example ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Database
2
+ DATABASE_URL=postgresql+asyncpg://postgres:postgres_password@localhost:5432/chatbot
3
+
4
+ # Redis
5
+ REDIS_URL=redis://localhost:6379
6
+
7
+ # OpenAI
8
+ OPENAI_API_KEY=your_openai_api_key_here
9
+
10
+ # Security
11
+ SECRET_KEY=your-super-secret-key-change-this-in-production
12
+
13
+ # CORS
14
+ CORS_ORIGINS=http://localhost:3000,http://localhost:8080
Dockerfile ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ COPY requirements.txt .
6
+ RUN pip install --no-cache-dir -r requirements.txt
7
+
8
+ COPY . .
9
+
10
+ EXPOSE 8000
11
+
12
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
chatbot.db ADDED
Binary file (53.2 kB). View file
 
logs.txt ADDED
File without changes
logs_err.txt ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\langchain_core\_api\deprecation.py:25: UserWarning: Core Pydantic V1 functionality isn't compatible with Python 3.14 or greater.
2
+ from pydantic.v1.fields import FieldInfo as FieldInfoV1
3
+ INFO: Started server process [22368]
4
+ INFO: Waiting for application startup.
5
+ ERROR: Traceback (most recent call last):
6
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\engine\base.py", line 143, in __init__
7
+ self._dbapi_connection = engine.raw_connection()
8
+ ~~~~~~~~~~~~~~~~~~~~~^^
9
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\engine\base.py", line 3317, in raw_connection
10
+ return self.pool.connect()
11
+ ~~~~~~~~~~~~~~~~~^^
12
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect
13
+ return _ConnectionFairy._checkout(self)
14
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
15
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout
16
+ fairy = _ConnectionRecord.checkout(pool)
17
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout
18
+ rec = pool._do_get()
19
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\impl.py", line 177, in _do_get
20
+ with util.safe_reraise():
21
+ ~~~~~~~~~~~~~~~~~^^
22
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 121, in __exit__
23
+ raise exc_value.with_traceback(exc_tb)
24
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\impl.py", line 175, in _do_get
25
+ return self._create_connection()
26
+ ~~~~~~~~~~~~~~~~~~~~~~~^^
27
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection
28
+ return _ConnectionRecord(self)
29
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__
30
+ self.__connect()
31
+ ~~~~~~~~~~~~~~^^
32
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect
33
+ with util.safe_reraise():
34
+ ~~~~~~~~~~~~~~~~~^^
35
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 121, in __exit__
36
+ raise exc_value.with_traceback(exc_tb)
37
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect
38
+ self.dbapi_connection = connection = pool._invoke_creator(self)
39
+ ~~~~~~~~~~~~~~~~~~~~^^^^^^
40
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect
41
+ return dialect.connect(*cargs_tup, **cparams)
42
+ ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
43
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect
44
+ return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501
45
+ ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
46
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 421, in connect
47
+ await_only(connection),
48
+ ~~~~~~~~~~^^^^^^^^^^^^
49
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only
50
+ return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501
51
+ ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
52
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn
53
+ value = await result
54
+ ^^^^^^^^^^^^
55
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\aiosqlite\core.py", line 168, in _connect
56
+ self._connection = await future
57
+ ^^^^^^^^^^^^
58
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\aiosqlite\core.py", line 63, in _connection_worker_thread
59
+ result = function()
60
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\aiosqlite\core.py", line 466, in connector
61
+ return sqlite3.connect(loc, **kwargs)
62
+ ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
63
+ sqlite3.OperationalError: unable to open database file
64
+
65
+ The above exception was the direct cause of the following exception:
66
+
67
+ Traceback (most recent call last):
68
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\starlette\routing.py", line 694, in lifespan
69
+ async with self.lifespan_context(app) as maybe_state:
70
+ ~~~~~~~~~~~~~~~~~~~~~^^^^^
71
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\contextlib.py", line 214, in __aenter__
72
+ return await anext(self.gen)
73
+ ^^^^^^^^^^^^^^^^^^^^^
74
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\fastapi\routing.py", line 216, in merged_lifespan
75
+ async with original_context(app) as maybe_original_state:
76
+ ~~~~~~~~~~~~~~~~^^^^^
77
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\contextlib.py", line 214, in __aenter__
78
+ return await anext(self.gen)
79
+ ^^^^^^^^^^^^^^^^^^^^^
80
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\fastapi\routing.py", line 216, in merged_lifespan
81
+ async with original_context(app) as maybe_original_state:
82
+ ~~~~~~~~~~~~~~~~^^^^^
83
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\contextlib.py", line 214, in __aenter__
84
+ return await anext(self.gen)
85
+ ^^^^^^^^^^^^^^^^^^^^^
86
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\fastapi\routing.py", line 216, in merged_lifespan
87
+ async with original_context(app) as maybe_original_state:
88
+ ~~~~~~~~~~~~~~~~^^^^^
89
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\contextlib.py", line 214, in __aenter__
90
+ return await anext(self.gen)
91
+ ^^^^^^^^^^^^^^^^^^^^^
92
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\fastapi\routing.py", line 216, in merged_lifespan
93
+ async with original_context(app) as maybe_original_state:
94
+ ~~~~~~~~~~~~~~~~^^^^^
95
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\fastapi\routing.py", line 241, in __aenter__
96
+ await self._router._startup()
97
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\fastapi\routing.py", line 4884, in _startup
98
+ await handler()
99
+ File "C:\Project\DocX\fastapi-backend\app\main.py", line 36, in startup
100
+ async with engine.begin() as conn:
101
+ ~~~~~~~~~~~~^^
102
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\contextlib.py", line 214, in __aenter__
103
+ return await anext(self.gen)
104
+ ^^^^^^^^^^^^^^^^^^^^^
105
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\ext\asyncio\engine.py", line 1068, in begin
106
+ async with conn:
107
+ ^^^^
108
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\ext\asyncio\base.py", line 121, in __aenter__
109
+ return await self.start(is_ctxmanager=True)
110
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
111
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\ext\asyncio\engine.py", line 275, in start
112
+ await greenlet_spawn(self.sync_engine.connect)
113
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn
114
+ result = context.throw(*sys.exc_info())
115
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\engine\base.py", line 3293, in connect
116
+ return self._connection_cls(self)
117
+ ~~~~~~~~~~~~~~~~~~~~^^^^^^
118
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\engine\base.py", line 145, in __init__
119
+ Connection._handle_dbapi_exception_noconnection(
120
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
121
+ err, dialect, engine
122
+ ^^^^^^^^^^^^^^^^^^^^
123
+ )
124
+ ^
125
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\engine\base.py", line 2448, in _handle_dbapi_exception_noconnection
126
+ raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
127
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\engine\base.py", line 143, in __init__
128
+ self._dbapi_connection = engine.raw_connection()
129
+ ~~~~~~~~~~~~~~~~~~~~~^^
130
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\engine\base.py", line 3317, in raw_connection
131
+ return self.pool.connect()
132
+ ~~~~~~~~~~~~~~~~~^^
133
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect
134
+ return _ConnectionFairy._checkout(self)
135
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
136
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout
137
+ fairy = _ConnectionRecord.checkout(pool)
138
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout
139
+ rec = pool._do_get()
140
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\impl.py", line 177, in _do_get
141
+ with util.safe_reraise():
142
+ ~~~~~~~~~~~~~~~~~^^
143
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 121, in __exit__
144
+ raise exc_value.with_traceback(exc_tb)
145
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\impl.py", line 175, in _do_get
146
+ return self._create_connection()
147
+ ~~~~~~~~~~~~~~~~~~~~~~~^^
148
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection
149
+ return _ConnectionRecord(self)
150
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__
151
+ self.__connect()
152
+ ~~~~~~~~~~~~~~^^
153
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect
154
+ with util.safe_reraise():
155
+ ~~~~~~~~~~~~~~~~~^^
156
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 121, in __exit__
157
+ raise exc_value.with_traceback(exc_tb)
158
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect
159
+ self.dbapi_connection = connection = pool._invoke_creator(self)
160
+ ~~~~~~~~~~~~~~~~~~~~^^^^^^
161
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect
162
+ return dialect.connect(*cargs_tup, **cparams)
163
+ ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
164
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect
165
+ return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501
166
+ ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
167
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\dialects\sqlite\aiosqlite.py", line 421, in connect
168
+ await_only(connection),
169
+ ~~~~~~~~~~^^^^^^^^^^^^
170
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only
171
+ return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501
172
+ ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
173
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn
174
+ value = await result
175
+ ^^^^^^^^^^^^
176
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\aiosqlite\core.py", line 168, in _connect
177
+ self._connection = await future
178
+ ^^^^^^^^^^^^
179
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\aiosqlite\core.py", line 63, in _connection_worker_thread
180
+ result = function()
181
+ File "C:\Users\Anton\AppData\Local\Programs\Python\Python314\Lib\site-packages\aiosqlite\core.py", line 466, in connector
182
+ return sqlite3.connect(loc, **kwargs)
183
+ ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
184
+ sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
185
+ (Background on this error at: https://sqlalche.me/e/20/e3q8)
186
+
187
+ ERROR: Application startup failed. Exiting.
requirements.txt ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fastapi==0.109.0
2
+ uvicorn[standard]==0.27.0
3
+ sqlalchemy==2.0.25
4
+ asyncpg==0.29.0
5
+ psycopg2-binary==2.9.9
6
+ redis==5.0.1
7
+ python-jose[cryptography]==3.3.0
8
+ passlib[bcrypt]==1.7.4
9
+ python-multipart==0.0.6
10
+ pydantic==2.5.3
11
+ pydantic-settings==2.1.0
12
+ openai==1.12.0
13
+ langchain==0.1.5
14
+ langchain-community==0.0.18
15
+ langchain-openai==0.0.5
16
+ pgvector==0.2.4
17
+ python-dotenv==1.0.0
18
+ aiofiles==23.2.1
19
+ pypdf==4.0.1
20
+ websockets==12.0
21
+ pytest==7.4.4
22
+ httpx==0.26.0
23
+ python-dateutil==2.8.2
24
+ numpy==1.26.4