本地启动报错

启动时候提示
Building prefix dict from the default dictionary …
DEBUG:jieba:Building prefix dict from the default dictionary …
Loading model from cache /var/folders/wr/dv245txd1b9_wh9hn6z4q7jh0000gn/T/jieba.cache
DEBUG:jieba:Loading model from cache /var/folders/wr/dv245txd1b9_wh9hn6z4q7jh0000gn/T/jieba.cache
Loading model cost 0.590 seconds.
DEBUG:jieba:Loading model cost 0.590 seconds.
Prefix dict has been built successfully.
DEBUG:jieba:Prefix dict has been built successfully.
Operations to perform:
Apply all migrations: application, contenttypes, dataset, django_apscheduler, django_celery_beat, embedding, function_lib, setting, users
Running migrations:
Applying embedding.0001_initial…2024-10-29 09:53:56 [schema DEBUG] CREATE TABLE “embedding” (“id” varchar(128) NOT NULL PRIMARY KEY, “source_id” varchar(128) NOT NULL, “source_type” varchar(5) NOT NULL, “is_active” boolean NOT NULL, “embedding” vector NOT NULL, “meta” jsonb NOT NULL, “dataset_id” uuid NOT NULL, “document_id” uuid NOT NULL, “paragraph_id” uuid NOT NULL); (params None)
ERROR:root:Perform migrate failed, exit
Traceback (most recent call last):
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/backends/utils.py”, line 87, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.errors.UndefinedObject: type “vector” does not exist
LINE 1: …T NULL, “is_active” boolean NOT NULL, “embedding” vector NOT…
^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/Users/mac/PycharmProjects/MaxKB/main.py”, line 40, in perform_db_migrate
management.call_command(‘migrate’)
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/core/management/init.py”, line 194, in call_command
return command.execute(*args, **defaults)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/core/management/base.py”, line 458, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/core/management/base.py”, line 106, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/core/management/commands/migrate.py”, line 356, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/migrations/executor.py”, line 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/migrations/executor.py”, line 167, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/migrations/executor.py”, line 252, in apply_migration
state = migration.apply(state, schema_editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/migrations/migration.py”, line 132, in apply
operation.database_forwards(
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/migrations/operations/models.py”, line 96, in database_forwards
schema_editor.create_model(model)
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/backends/base/schema.py”, line 451, in create_model
self.execute(sql, params or None)
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/backends/postgresql/schema.py”, line 45, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/backends/base/schema.py”, line 201, in execute
cursor.execute(sql, params)
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/backends/utils.py”, line 67, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/backends/utils.py”, line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/backends/utils.py”, line 84, in _execute
with self.db.wrap_database_errors:
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/utils.py”, line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File “/Users/mac/Library/Caches/pypoetry/virtualenvs/maxkb-EbiNS_KS-py3.11/lib/python3.11/site-packages/django/db/backends/utils.py”, line 87, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.ProgrammingError: type “vector” does not exist
LINE 1: …T NULL, “is_active” boolean NOT NULL, “embedding” vector NOT…
^
急需大佬协助

这个报错是PostgreSQL 中没有安装 vector 扩展插件,参照这个步骤解决一下:

解决了,是读配置时候读到example了,感谢指导

已经装上了vector extension 还是vector类型报错
错误信息和楼主的一毛一样

笑了 忘记切换数据库为maxkb了
我好菜

同学,在哪个文件里改,怎么改哟?方便给我说下吗?

修改config_example.yml文件中数据库名字。