聊天样式微调

This commit is contained in:
super committed 2026-03-29 11:45:36 +08:00
1 parent fafcdfe742
commit efae286f5c
12 files changed
+442 -293

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(git rev-parse --show-toplevel)"
cd "${ROOT_DIR}"
STAGED_FILES="$(git diff --cached --name-only --diff-filter=ACMR || true)"
if [[ -z "${STAGED_FILES}" ]]; then
exit 0
fi
MODELS_CHANGED=0
MIGRATION_CHANGED=0
if echo "${STAGED_FILES}" | grep -Eq '^backend/app/models\.py$'; then
MODELS_CHANGED=1
fi
if echo "${STAGED_FILES}" | grep -Eq '^backend/migrations/versions/.*\.py$'; then
MIGRATION_CHANGED=1
fi
if [[ "${MODELS_CHANGED}" -eq 1 && "${MIGRATION_CHANGED}" -eq 0 ]]; then
echo "[pre-commit] 检测到 backend/app/models.py 已暂存,但未检测到 migration 文件暂存。"
echo "[pre-commit] 请先执行:"
echo " cd backend"
echo " venv/bin/flask --app manage.py db migrate -m \"your_change\""
echo " venv/bin/flask --app manage.py db upgrade"
echo " git add backend/migrations/versions/*.py"
exit 1
fi
exit 0
+258
View File
@@ -0,0 +1,258 @@
#!/usr/bin/env python3
"""
Check schema drift between SQLAlchemy models and the current database.
Exit code:
0 -> no drift
1 -> drift found
2 -> runtime/config error
"""
from __future__ import annotations
import argparse
import os
import sys
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, Iterable, List, Set, Tuple
from sqlalchemy import inspect
# Ensure backend root is importable when this script runs from backend/scripts.
BACKEND_ROOT = Path(__file__).resolve().parents[1]
if str(BACKEND_ROOT) not in sys.path:
sys.path.insert(0, str(BACKEND_ROOT))
@dataclass
class DriftIssue:
category: str
table: str
detail: str
def _normalize_type(raw: str) -> str:
s = (raw or "").upper().replace(" ", "")
s = s.replace("CHARACTERVARYING", "VARCHAR")
s = s.replace("DOUBLEPRECISION", "FLOAT")
if s == "INT":
s = "INTEGER"
return s
def _types_equivalent(model_type: str, db_type: str) -> bool:
m = _normalize_type(model_type)
d = _normalize_type(db_type)
if m == d:
return True
# Numeric families (cross-dialect aliases)
float_family = {"FLOAT", "REAL", "NUMERIC"}
int_family = {"INTEGER", "BIGINT", "SMALLINT"}
if m in float_family and d in float_family:
return True
if m in int_family and d in int_family:
return m == d
return False
def _collect_model_uniques(table) -> Set[Tuple[str, ...]]:
unique_sets: Set[Tuple[str, ...]] = set()
for col in table.columns:
if col.unique:
unique_sets.add((col.name,))
for cons in table.constraints:
if cons.__class__.__name__ == "UniqueConstraint":
cols = tuple(col.name for col in cons.columns)
if cols:
unique_sets.add(cols)
return unique_sets
def _collect_db_uniques(insp, table_name: str) -> Set[Tuple[str, ...]]:
unique_sets: Set[Tuple[str, ...]] = set()
for uc in insp.get_unique_constraints(table_name):
cols = tuple(uc.get("column_names") or [])
if cols:
unique_sets.add(cols)
for idx in insp.get_indexes(table_name):
if idx.get("unique"):
cols = tuple(idx.get("column_names") or [])
if cols:
unique_sets.add(cols)
return unique_sets
def _collect_model_indexes(table) -> Set[Tuple[str, ...]]:
return {tuple(col.name for col in idx.columns) for idx in table.indexes}
def _collect_db_indexes(insp, table_name: str) -> Set[Tuple[str, ...]]:
idx_sets: Set[Tuple[str, ...]] = set()
for idx in insp.get_indexes(table_name):
cols = tuple(idx.get("column_names") or [])
if cols:
idx_sets.add(cols)
return idx_sets
def _collect_model_fks(table) -> Set[Tuple[str, str, str]]:
model_fks: Set[Tuple[str, str, str]] = set()
for col in table.columns:
for fk in col.foreign_keys:
model_fks.add((col.name, fk.column.table.name, fk.column.name))
return model_fks
def _collect_db_fks(insp, table_name: str) -> Set[Tuple[str, str, str]]:
db_fks: Set[Tuple[str, str, str]] = set()
for fk in insp.get_foreign_keys(table_name):
constrained_cols = fk.get("constrained_columns") or []
referred_cols = fk.get("referred_columns") or []
referred_table = fk.get("referred_table")
for constrained, referred in zip(constrained_cols, referred_cols):
db_fks.add((constrained, referred_table, referred))
return db_fks
def _format_tuple_set(values: Iterable[Tuple[str, ...]]) -> str:
parts = [f"({', '.join(v)})" for v in sorted(values)]
return ", ".join(parts)
def main() -> int:
parser = argparse.ArgumentParser(description="Check SQLAlchemy schema drift.")
parser.add_argument(
"--database-url",
default="",
help="Override DATABASE_URL for this check.",
)
args = parser.parse_args()
if args.database_url:
os.environ["DATABASE_URL"] = args.database_url
try:
from app import create_app, db
import app.models # noqa: F401 - ensure model metadata is registered
except Exception as exc:
print(f"[drift-check] Failed to import app/models: {exc}", file=sys.stderr)
return 2
app = create_app("development")
issues: List[DriftIssue] = []
with app.app_context():
insp = inspect(db.engine)
metadata = db.Model.metadata
model_tables = set(metadata.tables.keys())
db_tables = set(insp.get_table_names())
missing_tables = sorted(model_tables - db_tables)
for table in missing_tables:
issues.append(DriftIssue("table_missing_in_db", table, "table does not exist"))
extra_tables = sorted((db_tables - model_tables) - {"alembic_version"})
for table in extra_tables:
issues.append(DriftIssue("table_extra_in_db", table, "table not found in models"))
common_tables = sorted(model_tables & db_tables)
for table_name in common_tables:
model_table = metadata.tables[table_name]
model_cols: Dict[str, object] = {c.name: c for c in model_table.columns}
db_cols = {c["name"]: c for c in insp.get_columns(table_name)}
missing_cols = sorted(set(model_cols) - set(db_cols))
if missing_cols:
issues.append(
DriftIssue(
"column_missing_in_db",
table_name,
", ".join(missing_cols),
)
)
extra_cols = sorted(set(db_cols) - set(model_cols))
if extra_cols:
issues.append(
DriftIssue(
"column_extra_in_db",
table_name,
", ".join(extra_cols),
)
)
for col_name in sorted(set(model_cols) & set(db_cols)):
model_col = model_cols[col_name]
db_col = db_cols[col_name]
model_nullable = model_col.nullable
db_nullable = db_col.get("nullable", True)
if model_nullable != db_nullable:
issues.append(
DriftIssue(
"nullable_mismatch",
table_name,
f"{col_name}: model={model_nullable}, db={db_nullable}",
)
)
model_type = str(model_col.type)
db_type = str(db_col.get("type"))
if not _types_equivalent(model_type, db_type):
issues.append(
DriftIssue(
"type_mismatch",
table_name,
f"{col_name}: model={model_type}, db={db_type}",
)
)
model_uniques = _collect_model_uniques(model_table)
db_uniques = _collect_db_uniques(insp, table_name)
missing_uniques = model_uniques - db_uniques
if missing_uniques:
issues.append(
DriftIssue(
"unique_missing_in_db",
table_name,
_format_tuple_set(missing_uniques),
)
)
model_indexes = _collect_model_indexes(model_table)
db_indexes = _collect_db_indexes(insp, table_name)
missing_indexes = model_indexes - db_indexes
if missing_indexes:
issues.append(
DriftIssue(
"index_missing_in_db",
table_name,
_format_tuple_set(missing_indexes),
)
)
model_fks = _collect_model_fks(model_table)
db_fks = _collect_db_fks(insp, table_name)
missing_fks = model_fks - db_fks
if missing_fks:
fk_detail = ", ".join(
f"({col} -> {ref_table}.{ref_col})"
for col, ref_table, ref_col in sorted(missing_fks)
)
issues.append(DriftIssue("fk_missing_in_db", table_name, fk_detail))
if not issues:
print("[drift-check] OK: models and database schema are aligned.")
return 0
print("[drift-check] DRIFT FOUND:")
for issue in issues:
print(f" - [{issue.category}] {issue.table}: {issue.detail}")
return 1
if __name__ == "__main__":
raise SystemExit(main())
+80
View File
@@ -0,0 +1,80 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BACKEND_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
MIGRATIONS_DIR="${BACKEND_DIR}/migrations/versions"
FLASK_BIN="${BACKEND_DIR}/venv/bin/flask"
PYTHON_BIN="${BACKEND_DIR}/venv/bin/python3"
BASELINE_DB="${BACKEND_DIR}/local_test.db"
if [[ ! -x "${FLASK_BIN}" ]]; then
echo "[ci-check] missing flask executable: ${FLASK_BIN}"
exit 2
fi
if [[ ! -x "${PYTHON_BIN}" ]]; then
echo "[ci-check] missing python executable: ${PYTHON_BIN}"
exit 2
fi
TMP_DB="/tmp/hxops_ci_migration_${RANDOM}_$$.db"
TMP_LOG="/tmp/hxops_ci_migration_${RANDOM}_$$.log"
BEFORE_LIST="/tmp/hxops_ci_before_${RANDOM}_$$.txt"
AFTER_LIST="/tmp/hxops_ci_after_${RANDOM}_$$.txt"
cleanup() {
rm -f "${TMP_DB}" "${TMP_LOG}" "${BEFORE_LIST}" "${AFTER_LIST}"
}
trap cleanup EXIT
cd "${BACKEND_DIR}"
find "${MIGRATIONS_DIR}" -maxdepth 1 -type f -name "*.py" | sort > "${BEFORE_LIST}"
export DATABASE_URL="sqlite:///${TMP_DB}"
echo "[ci-check] DATABASE_URL=${DATABASE_URL}"
if [[ -f "${BASELINE_DB}" ]]; then
echo "[ci-check] step0: seed temp db from baseline local_test.db"
cp "${BASELINE_DB}" "${TMP_DB}"
else
echo "[ci-check] step0: baseline local_test.db not found, using empty temp db"
fi
echo "[ci-check] step1: upgrade temp db to head"
if ! "${FLASK_BIN}" --app manage.py db upgrade; then
echo "[ci-check] db upgrade failed."
if [[ -f "${BASELINE_DB}" ]]; then
echo "[ci-check] baseline exists but upgrade still failed. Please inspect migration chain."
else
echo "[ci-check] this repo's historical migrations may not support empty-db bootstrap."
echo "[ci-check] add/commit backend/local_test.db as baseline, or fix early revisions."
fi
exit 1
fi
echo "[ci-check] step2: schema drift check"
"${PYTHON_BIN}" scripts/check_schema_drift.py --database-url "${DATABASE_URL}"
echo "[ci-check] step3: autogenerate dry-check"
if ! "${FLASK_BIN}" --app manage.py db migrate -m "__ci_drift_check__" > "${TMP_LOG}" 2>&1; then
cat "${TMP_LOG}"
echo "[ci-check] migrate command failed."
exit 1
fi
find "${MIGRATIONS_DIR}" -maxdepth 1 -type f -name "*.py" | sort > "${AFTER_LIST}"
NEW_FILES="$(comm -13 "${BEFORE_LIST}" "${AFTER_LIST}" || true)"
if [[ -n "${NEW_FILES}" ]]; then
echo "[ci-check] DRIFT: autogenerate produced new migration(s):"
echo "${NEW_FILES}"
while IFS= read -r f; do
[[ -z "${f}" ]] && continue
rm -f "${f}"
done <<< "${NEW_FILES}"
echo "[ci-check] removed temporary generated migration file(s); please add a real migration."
exit 1
fi
echo "[ci-check] OK: no schema drift detected."
+2 -2
View File
@@ -10,8 +10,8 @@
<meta name="apple-mobile-web-app-title" content="hxai" />
<link rel="manifest" href="/manifest.webmanifest" />
<title>hxai</title>
<script type="module" crossorigin src="/assets/index-BeNIRipD.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-H6QPki_i.css">
<script type="module" crossorigin src="/assets/index-CevSaenJ.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CqpZrvvZ.css">
</head>
<body>
<div id="app"></div>
-1
View File
@@ -1 +0,0 @@
Single-database configuration for Flask.
-50
View File
@@ -1,50 +0,0 @@
# A generic, single database configuration.
[alembic]
# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic,flask_migrate
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
qualname =
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[logger_flask_migrate]
level = INFO
handlers =
qualname = flask_migrate
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
-113
View File
@@ -1,113 +0,0 @@
import logging
from logging.config import fileConfig
from flask import current_app
from alembic import context
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)
logger = logging.getLogger('alembic.env')
def get_engine():
try:
# this works with Flask-SQLAlchemy<3 and Alchemical
return current_app.extensions['migrate'].db.get_engine()
except (TypeError, AttributeError):
# this works with Flask-SQLAlchemy>=3
return current_app.extensions['migrate'].db.engine
def get_engine_url():
try:
return get_engine().url.render_as_string(hide_password=False).replace(
'%', '%%')
except AttributeError:
return str(get_engine().url).replace('%', '%%')
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
config.set_main_option('sqlalchemy.url', get_engine_url())
target_db = current_app.extensions['migrate'].db
# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
def get_metadata():
if hasattr(target_db, 'metadatas'):
return target_db.metadatas[None]
return target_db.metadata
def run_migrations_offline():
"""Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output.
"""
url = config.get_main_option("sqlalchemy.url")
context.configure(
url=url, target_metadata=get_metadata(), literal_binds=True
)
with context.begin_transaction():
context.run_migrations()
def run_migrations_online():
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
"""
# this callback is used to prevent an auto-migration from being generated
# when there are no changes to the schema
# reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html
def process_revision_directives(context, revision, directives):
if getattr(config.cmd_opts, 'autogenerate', False):
script = directives[0]
if script.upgrade_ops.is_empty():
directives[:] = []
logger.info('No changes in schema detected.')
conf_args = current_app.extensions['migrate'].configure_args
if conf_args.get("process_revision_directives") is None:
conf_args["process_revision_directives"] = process_revision_directives
connectable = get_engine()
with connectable.connect() as connection:
context.configure(
connection=connection,
target_metadata=get_metadata(),
**conf_args
)
with context.begin_transaction():
context.run_migrations()
if context.is_offline_mode():
run_migrations_offline()
else:
run_migrations_online()
-24
View File
@@ -1,24 +0,0 @@
"""${message}
Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
# revision identifiers, used by Alembic.
revision = ${repr(up_revision)}
down_revision = ${repr(down_revision)}
branch_labels = ${repr(branch_labels)}
depends_on = ${repr(depends_on)}
def upgrade():
${upgrades if upgrades else "pass"}
def downgrade():
${downgrades if downgrades else "pass"}
@@ -1,101 +0,0 @@
"""Initial migration
Revision ID: 7e0f9be4da73
Revises:
Create Date: 2026-02-22 22:06:59.375138
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7e0f9be4da73'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('agents',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=100), nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('icon_url', sa.String(length=255), nullable=True),
sa.Column('dify_app_id', sa.String(length=100), nullable=False),
sa.Column('dify_api_key', sa.String(length=100), nullable=False),
sa.Column('is_active', sa.Boolean(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('dify_app_id')
)
op.create_table('users',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('username', sa.String(length=50), nullable=False),
sa.Column('email', sa.String(length=100), nullable=False),
sa.Column('department', sa.String(length=100), nullable=True),
sa.Column('role', sa.String(length=20), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('email')
)
with op.batch_alter_table('users', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_users_username'), ['username'], unique=True)
op.create_table('chat_logs',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('conversation_id', sa.String(length=100), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('agent_id', sa.Integer(), nullable=False),
sa.Column('query', sa.Text(), nullable=False),
sa.Column('answer', sa.Text(), nullable=True),
sa.Column('tokens_used', sa.Integer(), nullable=False),
sa.Column('latency_ms', sa.Integer(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.ForeignKeyConstraint(['agent_id'], ['agents.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
with op.batch_alter_table('chat_logs', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_chat_logs_agent_id'), ['agent_id'], unique=False)
batch_op.create_index(batch_op.f('ix_chat_logs_conversation_id'), ['conversation_id'], unique=False)
batch_op.create_index(batch_op.f('ix_chat_logs_created_at'), ['created_at'], unique=False)
batch_op.create_index(batch_op.f('ix_chat_logs_user_id'), ['user_id'], unique=False)
op.create_table('user_agent_permissions',
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('agent_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['agent_id'], ['agents.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('user_id', 'agent_id')
)
op.create_table('feedbacks',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('chat_log_id', sa.Integer(), nullable=False),
sa.Column('score', sa.Integer(), nullable=False),
sa.Column('tags', sa.JSON(), nullable=True),
sa.Column('comment', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['chat_log_id'], ['chat_logs.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('chat_log_id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('feedbacks')
op.drop_table('user_agent_permissions')
with op.batch_alter_table('chat_logs', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_chat_logs_user_id'))
batch_op.drop_index(batch_op.f('ix_chat_logs_created_at'))
batch_op.drop_index(batch_op.f('ix_chat_logs_conversation_id'))
batch_op.drop_index(batch_op.f('ix_chat_logs_agent_id'))
op.drop_table('chat_logs')
with op.batch_alter_table('users', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_users_username'))
op.drop_table('users')
op.drop_table('agents')
# ### end Alembic commands ###
+37
View File
@@ -113,6 +113,29 @@
border-color: rgba(148, 163, 184, 0.26);
box-shadow: var(--glow-accent);
}
/* Keep chat composer border and fill visually consistent in light/dark themes. */
.chat-composer-shell {
background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 250, 252, 0.97) 100%);
box-shadow: 0 14px 28px -20px rgba(15, 23, 42, 0.38);
background-clip: padding-box;
}
.chat-composer-shell:focus-within {
transform: translateY(-1px);
box-shadow: 0 16px 34px -22px rgba(14, 165, 233, 0.45);
}
.chat-composer-textarea {
background-color: transparent !important;
border: 0 !important;
text-decoration: none;
caret-color: #0891b2;
}
.chat-composer-textarea::selection {
background-color: rgba(14, 165, 233, 0.2);
}
}
@layer components {
@@ -150,6 +173,20 @@ html.dark .glass-panel {
background: rgba(2, 6, 23, 0.66);
border-color: rgba(71, 85, 105, 0.5);
}
html.dark .chat-composer-shell {
background-image: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(10, 16, 30, 0.92) 100%);
box-shadow: 0 18px 36px -28px rgba(2, 6, 23, 0.96);
}
html.dark .chat-composer-textarea {
background-color: transparent !important;
caret-color: #67e8f9;
}
html.dark .chat-composer-textarea::selection {
background-color: rgba(56, 189, 248, 0.25);
}
}
/* Custom Scrollbar */
+5 -2
View File
@@ -743,15 +743,18 @@ const submitFeedback = async () => {
<footer class="safe-bottom-lg sticky bottom-0 z-20 border-t border-slate-200/80 bg-white/70 p-4 backdrop-blur-xl dark:border-slate-700/70 dark:bg-slate-950/65 md:p-6">
<div class="relative mx-auto max-w-5xl">
<div class="relative rounded-2xl border border-slate-200 bg-white/95 shadow-xl shadow-slate-300/25 transition-all duration-300 focus-within:border-cyan-500 focus-within:ring-2 focus-within:ring-cyan-500/25 dark:border-slate-700 dark:bg-slate-900/88 dark:shadow-none">
<div class="chat-composer-shell relative overflow-hidden rounded-2xl border border-slate-200 bg-white/95 shadow-xl shadow-slate-300/25 transition-all duration-300 focus-within:border-cyan-500 focus-within:ring-2 focus-within:ring-cyan-500/25 dark:border-slate-700 dark:bg-slate-900/88 dark:shadow-none">
<textarea
v-model="input"
@keydown.enter.prevent="handleSend"
rows="1"
:placeholder="$t('chat.placeholder')"
class="w-full resize-none bg-transparent py-4 pl-5 pr-14 text-[15px] leading-relaxed text-slate-800 placeholder-slate-400 focus:outline-none dark:text-slate-100 dark:placeholder-slate-500"
class="chat-composer-textarea w-full resize-none bg-transparent py-4 pl-5 pr-14 text-[15px] leading-relaxed text-slate-800 placeholder-slate-400 focus:outline-none dark:text-slate-100 dark:placeholder-slate-500"
style="min-height: 56px; max-height: 220px;"
:disabled="isThinking"
spellcheck="false"
autocorrect="off"
autocapitalize="off"
></textarea>
<button
@click="handleSend"
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
if ! git -C "${ROOT_DIR}" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "[hook-install] ${ROOT_DIR} is not a git repository."
exit 1
fi
HOOK_PATH="${ROOT_DIR}/.githooks/pre-commit"
if [[ ! -f "${HOOK_PATH}" ]]; then
echo "[hook-install] missing hook file: ${HOOK_PATH}"
exit 1
fi
chmod +x "${HOOK_PATH}"
if ! git -C "${ROOT_DIR}" config core.hooksPath .githooks; then
echo "[hook-install] failed to set git config core.hooksPath."
echo "[hook-install] please run manually in your local shell:"
echo " git config core.hooksPath .githooks"
exit 1
fi
echo "[hook-install] Installed pre-commit hook successfully."
echo "[hook-install] core.hooksPath=$(git -C "${ROOT_DIR}" config --get core.hooksPath)"